aboutsummaryrefslogtreecommitdiff
path: root/test/bundler/integration/react/react-client.test.ts
diff options
context:
space:
mode:
authorGravatar Dave Caruso <me@paperdave.net> 2023-05-15 17:45:28 -0400
committerGravatar Dave Caruso <me@paperdave.net> 2023-05-15 17:45:28 -0400
commita2d422273ecbf0a03a39e540c1a5d3f01f5b9abd (patch)
tree48e3bbf65cc4df780ff94c307d0c8f9baa5ac382 /test/bundler/integration/react/react-client.test.ts
parente846eedd4ed169ac1c9bd1cbc4cca96b8825ffce (diff)
downloadbun-integration-tests.tar.gz
bun-integration-tests.tar.zst
bun-integration-tests.zip
Diffstat (limited to 'test/bundler/integration/react/react-client.test.ts')
-rw-r--r--test/bundler/integration/react/react-client.test.ts35
1 files changed, 22 insertions, 13 deletions
diff --git a/test/bundler/integration/react/react-client.test.ts b/test/bundler/integration/react/react-client.test.ts
index 0785b7630..d0994b5b8 100644
--- a/test/bundler/integration/react/react-client.test.ts
+++ b/test/bundler/integration/react/react-client.test.ts
@@ -1,6 +1,6 @@
import path from "path";
import { describe, test, expect } from "bun:test";
-import { bunExe } from "harness";
+import { bunExe } from "../../../harness";
const modes = [
//
@@ -20,23 +20,32 @@ describe("bundler integration, react client", () => {
} of combinations) {
test(label + ", NODE_ENV=" + nodeEnv, async () => {
const out = path.join(import.meta.dir, "dist/client/" + label + "-" + nodeEnv);
- const x = Bun.spawnSync(
- [bunExe(), "build", ...(args ?? []), "--outdir=" + out, "--splitting", path.join(import.meta.dir, "index.jsx")],
- {
- // cwd: import.meta.dir + "/react",
- env: nodeEnv ? { NODE_ENV: nodeEnv } : undefined,
- },
- );
+ const cmd = [
+ bunExe(),
+ "build",
+ ...(args ?? []),
+ "--outdir=" + out,
+ "--splitting",
+ path.join(import.meta.dir, "index.jsx"),
+ ];
+ console.log(cmd.join(" "));
+ const x = Bun.spawnSync(cmd, {
+ cwd: import.meta.dir,
+ env: nodeEnv ? { NODE_ENV: nodeEnv } : undefined,
+ });
if (x.exitCode !== 0) {
console.error(x.stderr.toString());
throw new Error("Failed to build");
}
- const proc = Bun.spawn(["node", path.join(import.meta.dir, "puppeteer.mjs"), out], {
- cwd: path.join(import.meta.dir, "react"),
+ const proc = Bun.spawnSync(["node", path.join(import.meta.dir, "puppeteer.mjs"), out], {
+ cwd: path.join(import.meta.dir),
});
- await proc.exited;
- expect(proc.exitCode).toBe(0);
- const output = JSON.parse(await new Response(proc.stdout).text());
+ if (!proc.success) {
+ console.error(proc.stderr.toString());
+ console.error(proc.stdout.toString());
+ expect(proc.exitCode).toBe(0);
+ }
+ const output = JSON.parse(proc.stdout.toString("utf-8"));
expect(output.logs).toMatchSnapshot("Browser console logs");
expect(output.domSnapshots).toMatchSnapshot("DOM Snapshots");
});