File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -8,3 +8,10 @@ export const hasMultipleResolves = function() {
88}
99
1010const MULTIPLE_RESOLVES_V = '10.12.0'
11+
12+ // `--unhandled-rejections` was introduced in Node `12.0.0`
13+ export const hasUnhandledFlag = function ( ) {
14+ return semver . gte ( version , UNHANDLED_FLAG_V )
15+ }
16+
17+ const UNHANDLED_FLAG_V = '12.0.0'
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import sinon from 'sinon'
33import testEach from 'test-each'
44
55import { EVENTS , EVENTS_MAP } from './helpers/events/main.js'
6+ import { hasUnhandledFlag } from './helpers/events/version.js'
67import { startLogging } from './helpers/init.js'
78import { normalizeMessage , normalizeCall } from './helpers/normalize.js'
89import { removeProcessListeners } from './helpers/remove.js'
@@ -57,13 +58,13 @@ test.serial(
5758 } ,
5859)
5960
61+ const UNHANDLED_FLAGS = hasUnhandledFlag ( )
62+ ? [ '--unhandled-rejections=none' , '--unhandled-rejections=strict' ]
63+ : [ ]
64+
6065testEach (
6166 EVENTS ,
62- [
63- '--no-warnings' ,
64- '--unhandled-rejections=none' ,
65- '--unhandled-rejections=strict' ,
66- ] ,
67+ [ '--no-warnings' , ...UNHANDLED_FLAGS ] ,
6768 ( { title } , { eventName } , flag ) => {
6869 test ( `should work with warnings-related CLI flags | ${ title } ` , async t => {
6970 t . snapshot (
You can’t perform that action at this time.
0 commit comments