From 92b174b3156f317ae942f0be4ca89f05df99a4c6 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Mon, 1 Nov 2021 20:05:38 -0700 Subject: Add Bun.js integration tests, but don't run them yet. --- integration/snippets/styledcomponents-output.js | 48 +++++++++++++------------ 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'integration/snippets/styledcomponents-output.js') diff --git a/integration/snippets/styledcomponents-output.js b/integration/snippets/styledcomponents-output.js index 16ac1ed6b..a79b5e24d 100644 --- a/integration/snippets/styledcomponents-output.js +++ b/integration/snippets/styledcomponents-output.js @@ -32,28 +32,32 @@ const ErrorScreenRoot = styled.div` `; export function test() { - const reactEl = document.createElement("div"); - document.body.appendChild(reactEl); - ReactDOM.render( - - The react child should have this text - , - reactEl - ); + if (typeof window !== "undefined") { + const reactEl = document.createElement("div"); + document.body.appendChild(reactEl); + ReactDOM.render( + + The react child should have this text + , + reactEl + ); - const style = document.querySelector("style[data-styled]"); - console.assert(style, "style tag should exist"); - console.assert( - style.textContent.split("").every((a) => a.codePointAt(0) < 128), - "style tag should not contain invalid unicode codepoints" - ); - console.assert( - document.querySelector("#error-el").textContent === - "The react child should have this text" - ); + const style = document.querySelector("style[data-styled]"); + console.assert(style, "style tag should exist"); + console.assert( + style.textContent.split("").every((a) => a.codePointAt(0) < 128), + "style tag should not contain invalid unicode codepoints" + ); + console.assert( + document.querySelector("#error-el").textContent === + "The react child should have this text" + ); - ReactDOM.unmountComponentAtNode(reactEl); - reactEl.remove(); - style.remove(); - testDone(import.meta.url); + ReactDOM.unmountComponentAtNode(reactEl); + reactEl.remove(); + style.remove(); + return testDone(import.meta.url); + } + + return testDone(import.meta.url); } -- cgit v1.2.3