mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-14 13:22:37 +00:00
* fix(tests): run React tests from production shells Vitest preserves an inherited NODE_ENV, selecting React without its test APIs. Pin the environment before dependency resolution and worker startup in both test entry points. Co-authored-by: Ivan Malison <IvanMalison@gmail.com> * test(app): expect zero edits for a pure staged rename The rename patch correction on main preserves unchanged content. Keep the discard journey intact and update its obsolete added-line assertion. --------- Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com> Co-authored-by: Ivan Malison <IvanMalison@gmail.com>
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { spawnSync } from "node:child_process";
|
|
import { createRequire } from "node:module";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { expect, it } from "vitest";
|
|
|
|
const appDir = fileURLToPath(new URL(".", import.meta.url));
|
|
const rootDir = path.resolve(appDir, "../..");
|
|
const require = createRequire(import.meta.url);
|
|
const vitestEntry = path.join(path.dirname(require.resolve("vitest/package.json")), "vitest.mjs");
|
|
|
|
it.each([
|
|
{
|
|
name: "root",
|
|
cwd: rootDir,
|
|
args: ["packages/app/src/screens/workspace/use-mounted-tab-set.test.ts"],
|
|
},
|
|
{
|
|
name: "app",
|
|
cwd: appDir,
|
|
args: ["--project", "unit", "src/screens/workspace/use-mounted-tab-set.test.ts"],
|
|
},
|
|
])(
|
|
"$name tests can render React when the shell exports NODE_ENV=production",
|
|
({ cwd, args }) => {
|
|
const result = spawnSync(process.execPath, [vitestEntry, "run", ...args], {
|
|
cwd,
|
|
env: { ...process.env, NODE_ENV: "production" },
|
|
encoding: "utf8",
|
|
timeout: 30_000,
|
|
});
|
|
|
|
expect(result.error).toBeUndefined();
|
|
expect(result.status, result.stdout + result.stderr).toBe(0);
|
|
},
|
|
40_000,
|
|
);
|