Skip to content

Commit 90ea1a9

Browse files
committed
test: reuse planner modules between admission cases
1 parent 2b1eee0 commit 90ea1a9

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎test/scripts/test-projects-build-admission.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ const e2eConfig = "test/vitest/vitest.e2e.config.ts";
3737
let originalArgv: string[];
3838
let originalExitCode: typeof process.exitCode;
3939
let terminal: ReturnType<typeof createDeferred<unknown>>;
40+
const testProjectsUrl = new URL("../../scripts/test-projects.mts", import.meta.url).href;
41+
let startCount = 0;
4042

4143
beforeEach(() => {
42-
vi.resetModules();
4344
commands.prepare.mockReset();
4445
commands.prepareE2e.mockReset();
4546
commands.reader.mockReset().mockImplementation(() => ({
@@ -287,7 +288,8 @@ syncBuiltinESMExports();\n`,
287288

288289
async function start(args: string[]) {
289290
process.argv = [process.execPath, "scripts/test-projects.mts", ...args];
290-
await import("../../scripts/test-projects.mts");
291+
// Replay the command entry while retaining its immutable planner dependencies.
292+
await import(`${testProjectsUrl}?case=${startCount++}`);
291293
}
292294

293295
describe("test-projects build admission", () => {

0 commit comments

Comments
 (0)