Skip to content

Commit e234216

Browse files
committed
Improve test logic
1 parent a476b8f commit e234216

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/main.test.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { emitWarning } from 'node:process'
2-
import { promisify } from 'node:util'
2+
import { setImmediate } from 'node:timers/promises'
33

44
import test from 'ava'
55
import ModernError from 'modern-errors'
@@ -8,9 +8,6 @@ import { each } from 'test-each'
88

99
import modernErrorsProcess from 'modern-errors-process'
1010

11-
// TODO: use `timers/promises` after dropping support for Node <15
12-
const pSetInterval = promisify(setInterval)
13-
1411
const BaseError = ModernError.subclass('BaseError', {
1512
plugins: [modernErrorsProcess],
1613
})
@@ -28,7 +25,7 @@ each(
2825

2926
const createProcessError = async (error) => {
3027
emitWarning(error)
31-
await pSetInterval()
28+
await setImmediate()
3229
}
3330

3431
test.serial('Prints on the console by default', async (t) => {

0 commit comments

Comments
 (0)