@@ -12,8 +12,7 @@ const Timer = process.binding('timer_wrap').Timer;
12
12
const testRoot = process . env . NODE_TEST_DIR ?
13
13
path . resolve ( process . env . NODE_TEST_DIR ) : __dirname ;
14
14
15
- exports . testDir = __dirname ;
16
- exports . fixturesDir = path . join ( exports . testDir , 'fixtures' ) ;
15
+ exports . fixturesDir = path . join ( __dirname , 'fixtures' ) ;
17
16
exports . tmpDirName = 'tmp' ;
18
17
// PORT should match the definition in test/testpy/__init__.py.
19
18
exports . PORT = + process . env . NODE_COMMON_PORT || 12346 ;
@@ -195,13 +194,6 @@ if (exports.isWindows) {
195
194
exports . PIPE = exports . tmpDir + '/test.sock' ;
196
195
}
197
196
198
- if ( exports . isWindows ) {
199
- exports . faketimeCli = false ;
200
- } else {
201
- exports . faketimeCli = path . join ( __dirname , '..' , 'tools' , 'faketime' , 'src' ,
202
- 'faketime' ) ;
203
- }
204
-
205
197
var ifaces = os . networkInterfaces ( ) ;
206
198
exports . hasIPv6 = Object . keys ( ifaces ) . some ( function ( name ) {
207
199
return / l o / . test ( name ) && ifaces [ name ] . some ( function ( info ) {
@@ -285,17 +277,19 @@ exports.platformTimeout = function(ms) {
285
277
return ms ; // ARMv8+
286
278
} ;
287
279
288
- var knownGlobals = [ setTimeout ,
289
- setInterval ,
290
- setImmediate ,
291
- clearTimeout ,
292
- clearInterval ,
293
- clearImmediate ,
294
- console ,
295
- constructor , // Enumerable in V8 3.21.
296
- Buffer ,
297
- process ,
298
- global ] ;
280
+ var knownGlobals = [
281
+ Buffer ,
282
+ clearImmediate ,
283
+ clearInterval ,
284
+ clearTimeout ,
285
+ console ,
286
+ constructor , // Enumerable in V8 3.21.
287
+ global ,
288
+ process ,
289
+ setImmediate ,
290
+ setInterval ,
291
+ setTimeout
292
+ ] ;
299
293
300
294
if ( global . gc ) {
301
295
knownGlobals . push ( global . gc ) ;
@@ -360,7 +354,7 @@ function leakedGlobals() {
360
354
var leaked = [ ] ;
361
355
362
356
for ( var val in global )
363
- if ( - 1 === knownGlobals . indexOf ( global [ val ] ) )
357
+ if ( ! knownGlobals . includes ( global [ val ] ) )
364
358
leaked . push ( val ) ;
365
359
366
360
return leaked ;
@@ -375,7 +369,7 @@ process.on('exit', function() {
375
369
var leaked = leakedGlobals ( ) ;
376
370
if ( leaked . length > 0 ) {
377
371
console . error ( 'Unknown globals: %s' , leaked ) ;
378
- assert . ok ( false , 'Unknown global found' ) ;
372
+ fail ( 'Unknown global found' ) ;
379
373
}
380
374
} ) ;
381
375
@@ -440,9 +434,10 @@ exports.fileExists = function(pathname) {
440
434
}
441
435
} ;
442
436
443
- exports . fail = function ( msg ) {
437
+ function fail ( msg ) {
444
438
assert . fail ( null , null , msg ) ;
445
- } ;
439
+ }
440
+ exports . fail = fail ;
446
441
447
442
exports . skip = function ( msg ) {
448
443
console . log ( `1..0 # Skipped: ${ msg } ` ) ;
@@ -493,9 +488,9 @@ exports.nodeProcessAborted = function nodeProcessAborted(exitCode, signal) {
493
488
// one of them (exit code or signal) needs to be set to one of
494
489
// the expected exit codes or signals.
495
490
if ( signal !== null ) {
496
- return expectedSignals . indexOf ( signal ) > - 1 ;
491
+ return expectedSignals . includes ( signal ) ;
497
492
} else {
498
- return expectedExitCodes . indexOf ( exitCode ) > - 1 ;
493
+ return expectedExitCodes . includes ( exitCode ) ;
499
494
}
500
495
} ;
501
496
0 commit comments