test: speed up core runtime suites

This commit is contained in:
Peter Steinberger
2026-03-31 02:12:14 +01:00
parent f7285e0a9e
commit 6b6ddcd2a6
93 changed files with 874 additions and 980 deletions

View File

@@ -1,4 +1,4 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
const { spawnMock } = vi.hoisted(() => ({
spawnMock: vi.fn(),
@@ -25,9 +25,11 @@ async function withPlatform<T>(platform: NodeJS.Platform, run: () => Promise<T>
describe("killProcessTree", () => {
let killSpy: ReturnType<typeof vi.spyOn>;
beforeEach(async () => {
vi.resetModules();
beforeAll(async () => {
({ killProcessTree } = await import("./kill-tree.js"));
});
beforeEach(() => {
spawnMock.mockClear();
killSpy = vi.spyOn(process, "kill");
vi.useFakeTimers();