diff options
author | isaacs <i@izs.me> | 2021-11-18 20:02:06 +0300 |
---|---|---|
committer | Nathan Fritz <fritzy@github.com> | 2021-11-18 22:43:26 +0300 |
commit | 654908fa3035283045d4238701bd34199a94d1a1 (patch) | |
tree | 873ffad7a605637eb09419e445f5801dd277c5a9 /test/lib | |
parent | 44e39ce7042a162f53a708ee4660e84638a66f6b (diff) |
chore: more faithfully mock global.process in test
PR-URL: https://github.com/npm/cli/pull/4052
Credit: @isaacs
Close: #4052
Reviewed-by: @wraithgar
Diffstat (limited to 'test/lib')
-rw-r--r-- | test/lib/utils/exit-handler.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/lib/utils/exit-handler.js b/test/lib/utils/exit-handler.js index f74938750..adc7c3f4e 100644 --- a/test/lib/utils/exit-handler.js +++ b/test/lib/utils/exit-handler.js @@ -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(), @@ -62,6 +59,9 @@ process = Object.assign( } }, stderr: { write () {} }, hrtime: _process.hrtime, + kill: () => {}, + reallyExit: (code) => process.exit(code), + pid: 123456, } ) |