From 97938582e573704c86471c7f386b29cafadbe5a7 Mon Sep 17 00:00:00 2001 From: Tianyi Cui <53024+tianyicui@users.noreply.github.com> Date: Sun, 23 Aug 2026 15:55:46 +0800 Subject: [PATCH] test(docs): avoid duplicate fixture cleanup --- scripts/verify-subsystem-pages.spec.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/scripts/verify-subsystem-pages.spec.ts b/scripts/verify-subsystem-pages.spec.ts index fa8fbc8553..65e696468c 100644 --- a/scripts/verify-subsystem-pages.spec.ts +++ b/scripts/verify-subsystem-pages.spec.ts @@ -3,18 +3,12 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs' import { tmpdir } from 'node:os' import { dirname, join } from 'node:path' -import { afterEach, describe, expect, it } from 'vitest' +import { describe, expect, it, onTestFinished } from 'vitest' import { auditSubsystemPages } from './verify-subsystem-pages.ts' -const roots: string[] = [] - -afterEach(() => { - for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true }) -}) - function fixture(): string { const root = mkdtempSync(join(tmpdir(), 'dsh-subsystem-pages-')) - roots.push(root) + onTestFinished(() => rmSync(root, { recursive: true, force: true })) return root }