Repository: preactjs/preact-render-to-string (js)

Issue:
Rendering shallow makes a Fragment into a <p>
Shallow rendering this:
`<><ComponentX /></>`
Creates this:
`<p><ComponentX /></p>`

Is that intended behaviour? Why not just `<ComponentX />`

Pull request description:
fix: shallow render with fragment at top lvl
Fixes #262 

Patch:
diff --git a/.changeset/fast-rockets-admire.md b/.changeset/fast-rockets-admire.md
new file mode 100644
index 0000000..ebec71e
--- /dev/null
+++ b/.changeset/fast-rockets-admire.md
@@ -0,0 +1,5 @@
+---
+'preact-render-to-string': patch
+---
+
+Fix for shallow rendering incorrectly transforming Fragments into other nodes
diff --git a/src/pretty.js b/src/pretty.js
index 70e9e5a..59df0e4 100644
--- a/src/pretty.js
+++ b/src/pretty.js
@@ -103,7 +103,11 @@ function _renderToStringPretty(
 	// components
 	if (typeof nodeName === 'function') {
 		isComponent = true;
-		if (opts.shallow && (inner || opts.renderRootComponent === false)) {
+		if (
+			opts.shallow &&
+			(inner || opts.renderRootComponent === false) &&
+			nodeName !== Fragment
+		) {
 			nodeName = getComponentName(nodeName);
 		} else if (nodeName === Fragment) {
 			const children = [];


Test patch:
diff --git a/test/shallowRender.test.jsx b/test/shallowRender.test.jsx
index 8b981f3..ca33244 100644
--- a/test/shallowRender.test.jsx
+++ b/test/shallowRender.test.jsx
@@ -52,12 +52,26 @@ describe('shallowRender()', () => {
 		expect(Test).to.have.been.calledOnce;
 	});
 
-	it('should ignore Fragments', () => {
-		let rendered = shallowRender(
-			<Fragment>
-				<div>foo</div>
-			</Fragment>
-		);
-		expect(rendered).to.equal(`<div>foo</div>`);
+	describe('should ignore Fragments', () => {
+		it('passed directly', () => {
+			let rendered = shallowRender(
+				<Fragment>
+					<div>foo</div>
+				</Fragment>
+			);
+			expect(rendered).to.equal(`<div>foo</div>`);
+		});
+
+		it('passed from FC', () => {
+			const Test = () => (
+				<Fragment>
+					<div>foo</div>
+				</Fragment>
+			);
+
+			let rendered = shallowRender(<Test />);
+
+			expect(rendered).to.equal(`<div>foo</div>`);
+		});
 	});
 });