Skip to content

Commit 616a24e

Browse files
committed
test(ci): route E2E setup regression correctly
1 parent 14b6d72 commit 616a24e

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

test/vitest/vitest.e2e.global-setup.test.ts renamed to test/scripts/vitest-e2e-global-setup.test.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
waitForDead,
1414
waitForPidFile,
1515
} from "../helpers/process-wait.js";
16-
import { runE2eGlobalSetup } from "./vitest.e2e.global-setup.js";
16+
import { runE2eGlobalSetup } from "../vitest/vitest.e2e.global-setup.js";
1717

1818
type SetupCommandRunner = NonNullable<Parameters<typeof runE2eGlobalSetup>[0]>;
1919

@@ -22,15 +22,18 @@ const PROCESS_TIMEOUT_MS = process.env.CI ? 15_000 : 5_000;
2222

2323
describe("vitest E2E global setup", () => {
2424
it("runs both build commands sequentially with their exact environments", async () => {
25-
const firstCommand = Promise.withResolvers<number>();
25+
let resolveFirstCommand!: (status: number) => void;
26+
const firstCommand = new Promise<number>((resolve) => {
27+
resolveFirstCommand = resolve;
28+
});
2629
const runCommand = vi
2730
.fn<SetupCommandRunner>()
28-
.mockImplementationOnce(() => firstCommand.promise)
31+
.mockImplementationOnce(() => firstCommand)
2932
.mockResolvedValueOnce(0);
3033

3134
const setupPromise = runE2eGlobalSetup(runCommand);
3235
await vi.waitFor(() => expect(runCommand).toHaveBeenCalledTimes(1));
33-
firstCommand.resolve(0);
36+
resolveFirstCommand(0);
3437
await setupPromise;
3538
expect(runCommand.mock.calls).toEqual([
3639
[
@@ -74,7 +77,7 @@ process.stdin.once("data", () => {
7477
process.stdin.resume();
7578
`,
7679
);
77-
const setupUrl = new URL("./vitest.e2e.global-setup.ts", import.meta.url).href;
80+
const setupUrl = new URL("../vitest/vitest.e2e.global-setup.ts", import.meta.url).href;
7881
const runnerScript = `import { runE2eSetupCommand } from ${JSON.stringify(setupUrl)};
7982
await runE2eSetupCommand([${JSON.stringify(fixturePath)}], process.env);`;
8083
const runner = spawn(

0 commit comments

Comments
 (0)