test(docs): avoid duplicate fixture cleanup
This commit is contained in:
parent
4bc6f4bdf7
commit
97938582e5
1 changed files with 2 additions and 8 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue