1- import { version } from 'process'
21import { inspect } from 'util'
32
43import test from 'ava'
5- import semver from 'semver'
64import sinon from 'sinon'
75import { each } from 'test-each'
86
97import { EVENTS } from './helpers/events/main.js'
108import { startLogging } from './helpers/init.js'
119import { LEVELS } from './helpers/level.js'
1210import { normalizeMessage } from './helpers/normalize.js'
13- // eslint-disable-next-line import/max-dependencies
1411import { removeProcessListeners } from './helpers/remove.js'
1512
1613removeProcessListeners ( )
@@ -25,9 +22,6 @@ const snapshotArgs = function ([error, level, mainValue]) {
2522 ]
2623}
2724
28- // Stack traces change with this Node.js version
29- const MIN_STACK_VERSION = '14.0.0'
30-
3125each ( [ EVENTS [ 0 ] ] , ( { title } , { eventName, emit } ) => {
3226 test . serial ( `should fire opts.log() | ${ title } ` , async ( t ) => {
3327 const { stopLogging, log } = startLogging ( { log : 'spy' } )
@@ -53,23 +47,18 @@ each([EVENTS[0]], ({ title }, { eventName, emit }) => {
5347 stopLogging ( )
5448 } )
5549
56- if ( semver . gte ( version , MIN_STACK_VERSION ) ) {
57- test . serial (
58- `should fire opts.log() with arguments | ${ title } ` ,
59- async ( t ) => {
60- const { stopLogging, log } = startLogging ( { log : 'spy' , eventName } )
50+ test . serial ( `should fire opts.log() with arguments | ${ title } ` , async ( t ) => {
51+ const { stopLogging, log } = startLogging ( { log : 'spy' , eventName } )
6152
62- await emit ( { all : true } )
53+ await emit ( { all : true } )
6354
64- t . true ( log . called )
55+ t . true ( log . called )
6556
66- const snapshot = log . args . flatMap ( snapshotArgs )
67- t . snapshot ( snapshot )
57+ const snapshot = log . args . flatMap ( snapshotArgs )
58+ t . snapshot ( snapshot )
6859
69- stopLogging ( )
70- } ,
71- )
72- }
60+ stopLogging ( )
61+ } )
7362} )
7463
7564each ( EVENTS , LEVELS , ( { title } , { eventName, emit } , level ) => {
0 commit comments