Skip to content

Commit 68c2ad4

Browse files
test(rsc): run Parcel tests against production build (#13972)
1 parent 3f0526b commit 68c2ad4

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

integration/helpers/rsc-parcel/src/server.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { parseArgs } from "node:util";
12
import { createRequestListener } from "@mjackson/node-fetch-server";
23
import express from "express";
34
import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
@@ -71,7 +72,12 @@ app.use(
7172
)
7273
);
7374

74-
const port = parseInt(process.env.RR_PORT || "3000", 10);
75+
const { values } = parseArgs({
76+
options: { p: { type: "string", default: process.env.RR_PORT || "3000" } },
77+
allowPositionals: true,
78+
});
79+
80+
const port = parseInt(values.p, 10);
7581
app.listen(port, () => {
7682
console.log(`Server started on http://localhost:${port}`);
7783
});

integration/rsc/rsc-test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,13 @@ const implementations: Implementation[] = [
4646
template: "rsc-parcel",
4747
build: ({ cwd }: { cwd: string }) => spawnSync("pnpm", ["build"], { cwd }),
4848
run: ({ cwd, port }) =>
49-
// FIXME: Parcel prod builds seems to have dup copies of react in them :/
50-
// Not reproducible in the playground though - only in integration/helpers...
51-
implementations.find((i) => i.name === "parcel")!.dev({ cwd, port }),
49+
createDev(["dist/server/server.js", "-p", String(port)])({
50+
cwd,
51+
port,
52+
env: {
53+
NODE_ENV: "production",
54+
},
55+
}),
5256
dev: ({ cwd, port }) =>
5357
createDev(["node_modules/parcel/lib/bin.js"])({
5458
// Since we run through parcels dev server we can't use `-p` because that

0 commit comments

Comments
 (0)