test(auth): warm the Welcome import once so the first case cannot time out under load

This commit is contained in:
2026-10-03 21:53:06 +02:00
parent fb6b56f121
commit dc00b55feb
@@ -7,7 +7,7 @@
//
// entryUrl snapshots window.location at IMPORT time, so the access-notice cases reset the module
// registry and set the URL before importing — that is the behaviour under test, not a workaround.
import { describe, it, expect, afterEach, vi } from "vitest";
import { describe, it, expect, afterEach, beforeAll, vi } from "vitest";
import { render, screen, fireEvent, cleanup, act } from "@testing-library/react";
import type { VerifyEntry } from "../lib/useVerifyEntry";
@@ -18,6 +18,13 @@ const noVerify: VerifyEntry = {
dismiss: () => {},
};
// Every case re-imports the whole Welcome tree after a module reset. The FIRST import also transforms
// it, which under the full suite's parallel load ran past the 5 s test timeout (E32 S2, gate flake).
// Transforms survive resetModules, so warming them once here leaves each case only the evaluation.
beforeAll(async () => {
await import("./Welcome");
}, 60_000);
afterEach(() => {
cleanup();
vi.resetModules();