Five tests restore fake timers only at the end of their body, so a failed assertion left fake timers to the next test in the same file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
15 lines
483 B
TypeScript
15 lines
483 B
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
|
|
// tests/setup.ts restores real timers after every test, so a test that fails
|
|
// before its own vi.useRealTimers() does not hand fake timers to the next one.
|
|
describe("global test setup", () => {
|
|
it("may end with fake timers still installed", () => {
|
|
vi.useFakeTimers();
|
|
expect(vi.isFakeTimers()).toBe(true);
|
|
});
|
|
|
|
it("starts the next test on real timers", () => {
|
|
expect(vi.isFakeTimers()).toBe(false);
|
|
});
|
|
});
|