Skip to content

Commit 91c73ed

Browse files
committed
Simplify test
1 parent dca94aa commit 91c73ed

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

test/log.js

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
import { version } from 'process'
21
import { inspect } from 'util'
32

43
import test from 'ava'
5-
import semver from 'semver'
64
import sinon from 'sinon'
75
import { each } from 'test-each'
86

97
import { EVENTS } from './helpers/events/main.js'
108
import { startLogging } from './helpers/init.js'
119
import { LEVELS } from './helpers/level.js'
1210
import { normalizeMessage } from './helpers/normalize.js'
13-
// eslint-disable-next-line import/max-dependencies
1411
import { removeProcessListeners } from './helpers/remove.js'
1512

1613
removeProcessListeners()
@@ -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-
3125
each([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

7564
each(EVENTS, LEVELS, ({ title }, { eventName, emit }, level) => {

0 commit comments

Comments
 (0)