Skip to content

Commit

Permalink
chore: more faithfully mock global.process in test
Browse files Browse the repository at this point in the history
PR-URL: #4052
Credit: @isaacs
Close: #4052
Reviewed-by: @wraithgar
  • Loading branch information
isaacs authored and fritzy committed Nov 18, 2021
1 parent 44e39ce commit 654908f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/lib/utils/exit-handler.js
Expand Up @@ -38,13 +38,10 @@ t.before(async () => {
npm.config.set('cache', cacheFolder)
})

t.test('bootstrap tap before cutting off process ref', (t) => {
t.ok('ok')
t.end()
})

// cut off process from script so that it won't quit the test runner
// while trying to run through the myriad of cases
// while trying to run through the myriad of cases. need to make it
// have all the functions signal-exit relies on so that it doesn't
// nerf itself, thinking global.process is broken or gone.
const _process = process
process = Object.assign(
new EventEmitter(),
Expand All @@ -62,6 +59,9 @@ process = Object.assign(
} },
stderr: { write () {} },
hrtime: _process.hrtime,
kill: () => {},
reallyExit: (code) => process.exit(code),
pid: 123456,
}
)

Expand Down

0 comments on commit 654908f

Please sign in to comment.