File tree 1 file changed +3
-8
lines changed
1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change 2
2
// Checks that setInterval timers keep running even when they're
3
3
// unrefed within their callback.
4
4
5
- require ( '../common' ) ;
6
- const assert = require ( 'assert' ) ;
5
+ const common = require ( '../common' ) ;
7
6
const net = require ( 'net' ) ;
8
7
9
8
let counter1 = 0 ;
@@ -28,15 +27,15 @@ function Test1() {
28
27
// server only for maintaining event loop
29
28
const server = net . createServer ( ) . listen ( 0 ) ;
30
29
31
- const timer1 = setInterval ( ( ) => {
30
+ const timer1 = setInterval ( common . mustCall ( ( ) => {
32
31
timer1 . unref ( ) ;
33
32
if ( counter1 ++ === 3 ) {
34
33
clearInterval ( timer1 ) ;
35
34
server . close ( ( ) => {
36
35
Test2 ( ) ;
37
36
} ) ;
38
37
}
39
- } , 1 ) ;
38
+ } , 4 ) , 1 ) ;
40
39
}
41
40
42
41
@@ -54,8 +53,4 @@ function Test2() {
54
53
} , 1 ) ;
55
54
}
56
55
57
- process . on ( 'exit' , ( ) => {
58
- assert . strictEqual ( counter1 , 4 ) ;
59
- } ) ;
60
-
61
56
Test1 ( ) ;
You can’t perform that action at this time.
0 commit comments