From 4dd6c7a509864e2a26beca81517aca8854ebb23f Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 2 Mar 2026 16:32:53 +0000 Subject: [PATCH] test(perf): avoid redundant root mkdir in hooks install tests --- src/hooks/install.test.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/hooks/install.test.ts b/src/hooks/install.test.ts index 5c0cabc141b..5930de2c2b7 100644 --- a/src/hooks/install.test.ts +++ b/src/hooks/install.test.ts @@ -2,7 +2,7 @@ import { randomUUID } from "node:crypto"; import fs from "node:fs"; import os from "node:os"; import path from "node:path"; -import { afterAll, beforeEach, describe, expect, it, vi } from "vitest"; +import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { expectSingleNpmPackIgnoreScriptsCall } from "../test-utils/exec-assertions.js"; import { expectInstallUsesIgnoreScripts, @@ -29,7 +29,6 @@ vi.mock("../process/exec.js", () => ({ })); function makeTempDir() { - fs.mkdirSync(fixtureRoot, { recursive: true }); const dir = path.join(fixtureRoot, `case-${tempDirIndex++}`); fs.mkdirSync(dir, { recursive: true }); return dir; @@ -51,6 +50,10 @@ beforeEach(() => { vi.clearAllMocks(); }); +beforeAll(() => { + fs.mkdirSync(fixtureRoot, { recursive: true }); +}); + function writeArchiveFixture(params: { fileName: string; contents: Buffer }) { const stateDir = makeTempDir(); const workDir = makeTempDir();