Files
wehub-resource-sync 70bf21e064
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:30:11 +08:00

25 lines
902 B
TypeScript

import { readFileSync } from "node:fs";
import { test } from "vitest";
import { isBuild, page } from "../../__test-utils__";
test("replaces process.env.NODE_ENV with the correct value", async ({
expect,
}) => {
const h1Content = await page.textContent("h1");
expect(h1Content).toEqual("Server Side React");
const pContent = await page.textContent("p");
expect(pContent).toEqual(
`The value of process.env.NODE_ENV is "${isBuild ? "production" : "development"}"`
);
});
test.skipIf(!isBuild)(
"the build output does not include react development code (such is tree-shaken away)",
async ({ expect }) => {
const outputJs = readFileSync("./dist/worker/index.js", "utf8");
expect(outputJs).not.toContain("react-dom.development.js");
// the React development code links to the facebook/react repo in a few places
expect(outputJs).not.toContain("https://github.com/facebook/react");
}
);