Skip to content

Commit

Permalink
make run tests pass with global-singleton TAP root obj
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Mar 8, 2024
1 parent e6dfb7a commit 89f0a0d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/run/test/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ type Result = {
stderr: string
}

// make sure we keep getting a fresh TAP when we re-import fresh
const privSym = Symbol.for('TAP private constructor')
const g = globalThis as typeof globalThis & {
[privSym]?: typeof t
}
t.beforeEach(() => {
delete g[privSym]
})

const run = async (
cwd: string,
args: string[] = [],
Expand Down Expand Up @@ -429,7 +438,6 @@ ok 1 - this is standard input
t.test('build before run if plugins mismatch', async t => {
const cwd = process.cwd()
t.teardown(() => process.chdir(cwd))

const { run } = await t.mockImport<
typeof import('../dist/esm/run.js')
>('../dist/esm/run.js', {
Expand Down

0 comments on commit 89f0a0d

Please sign in to comment.