| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5b2ca85 commit ad4bf9e
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,8 +38,9 @@ exports.rootDir = exports.isWindows ? 'c:\\' : '/'; | |||
| 38 | 38 | exports.buildType = process.config.target_defaults.default_configuration; | |
| 39 | 39 | ||
| 40 | 40 | function rimrafSync(p) { | |
| 41 | + let st; | ||
| 41 | 42 | try { | |
| 42 | - var st = fs.lstatSync(p); | ||
| 43 | + st = fs.lstatSync(p); | ||
| 43 | 44 | } catch (e) { | |
| 44 | 45 | if (e.code === 'ENOENT') | |
| 45 | 46 | return; | |
@@ -93,9 +94,9 @@ if (process.env.TEST_THREAD_ID) { | |||
| 93 | 94 | } | |
| 94 | 95 | exports.tmpDir = path.join(testRoot, exports.tmpDirName); | |
| 95 | 96 | ||
| 96 | - var opensslCli = null; | ||
| 97 | - var inFreeBSDJail = null; | ||
| 98 | - var localhostIPv4 = null; | ||
| 97 | + let opensslCli = null; | ||
| 98 | + let inFreeBSDJail = null; | ||
| 99 | + let localhostIPv4 = null; | ||
| 99 | 100 | ||
| 100 | 101 | exports.localIPv6Hosts = ['localhost']; | |
| 101 | 102 | if (exports.isLinux) { | |
@@ -165,8 +166,8 @@ Object.defineProperty(exports, 'opensslCli', {get: function() { | |||
| 165 | 166 | ||
| 166 | 167 | if (exports.isWindows) opensslCli += '.exe'; | |
| 167 | 168 | ||
| 168 | - var openssl_cmd = child_process.spawnSync(opensslCli, ['version']); | ||
| 169 | - if (openssl_cmd.status !== 0 || openssl_cmd.error !== undefined) { | ||
| 169 | + const opensslCmd = child_process.spawnSync(opensslCli, ['version']); | ||
| 170 | + if (opensslCmd.status !== 0 || opensslCmd.error !== undefined) { | ||
| 170 | 171 | // openssl command cannot be executed | |
| 171 | 172 | opensslCli = false; | |
| 172 | 173 | } | |
@@ -194,7 +195,7 @@ if (exports.isWindows) { | |||
| 194 | 195 | exports.PIPE = exports.tmpDir + '/test.sock'; | |
| 195 | 196 | } | |
| 196 | 197 | ||
| 197 | - var ifaces = os.networkInterfaces(); | ||
| 198 | + const ifaces = os.networkInterfaces(); | ||
| 198 | 199 | exports.hasIPv6 = Object.keys(ifaces).some(function(name) { | |
| 199 | 200 | return /lo/.test(name) && ifaces[name].some(function(info) { | |
| 200 | 201 | return info.family === 'IPv6'; | |
@@ -204,7 +205,7 @@ exports.hasIPv6 = Object.keys(ifaces).some(function(name) { | |||
| 204 | 205 | ||
| 205 | 206 | exports.ddCommand = function(filename, kilobytes) { | |
| 206 | 207 | if (exports.isWindows) { | |
| 207 | - var p = path.resolve(exports.fixturesDir, 'create-file.js'); | ||
| 208 | + const p = path.resolve(exports.fixturesDir, 'create-file.js'); | ||
| 208 | 209 | return '"' + process.argv[0] + '" "' + p + '" "' + | |
| 209 | 210 | filename + '" ' + (kilobytes * 1024); | |
| 210 | 211 | } else { | |
@@ -214,7 +215,7 @@ exports.ddCommand = function(filename, kilobytes) { | |||
| 214 | 215 | ||
| 215 | 216 | ||
| 216 | 217 | exports.spawnCat = function(options) { | |
| 217 | - var spawn = require('child_process').spawn; | ||
| 218 | + const spawn = require('child_process').spawn; | ||
| 218 | 219 | ||
| 219 | 220 | if (exports.isWindows) { | |
| 220 | 221 | return spawn('more', [], options); | |
@@ -225,7 +226,7 @@ exports.spawnCat = function(options) { | |||
| 225 | 226 | ||
| 226 | 227 | ||
| 227 | 228 | exports.spawnSyncCat = function(options) { | |
| 228 | - var spawnSync = require('child_process').spawnSync; | ||
| 229 | + const spawnSync = require('child_process').spawnSync; | ||
| 229 | 230 | ||
| 230 | 231 | if (exports.isWindows) { | |
| 231 | 232 | return spawnSync('more', [], options); | |
@@ -236,7 +237,7 @@ exports.spawnSyncCat = function(options) { | |||
| 236 | 237 | ||
| 237 | 238 | ||
| 238 | 239 | exports.spawnPwd = function(options) { | |
| 239 | - var spawn = require('child_process').spawn; | ||
| 240 | + const spawn = require('child_process').spawn; | ||
| 240 | 241 | ||
| 241 | 242 | if (exports.isWindows) { | |
| 242 | 243 | return spawn('cmd.exe', ['/c', 'cd'], options); | |
@@ -277,7 +278,7 @@ exports.platformTimeout = function(ms) { | |||
| 277 | 278 | return ms; // ARMv8+ | |
| 278 | 279 | }; | |
| 279 | 280 | ||
| 280 | - var knownGlobals = [ | ||
| 281 | + let knownGlobals = [ | ||
| 281 | 282 | Buffer, | |
| 282 | 283 | clearImmediate, | |
| 283 | 284 | clearInterval, | |
@@ -351,9 +352,9 @@ function allowGlobals(...whitelist) { | |||
| 351 | 352 | exports.allowGlobals = allowGlobals; | |
| 352 | 353 | ||
| 353 | 354 | function leakedGlobals() { | |
| 354 | - var leaked = []; | ||
| 355 | + const leaked = []; | ||
| 355 | 356 | ||
| 356 | - for (var val in global) | ||
| 357 | + for (const val in global) | ||
| 357 | 358 | if (!knownGlobals.includes(global[val])) | |
| 358 | 359 | leaked.push(val); | |
| 359 | 360 | ||
@@ -366,21 +367,21 @@ exports.globalCheck = true; | |||
| 366 | 367 | ||
| 367 | 368 | process.on('exit', function() { | |
| 368 | 369 | if (!exports.globalCheck) return; | |
| 369 | - var leaked = leakedGlobals(); | ||
| 370 | + const leaked = leakedGlobals(); | ||
| 370 | 371 | if (leaked.length > 0) { | |
| 371 | 372 | console.error('Unknown globals: %s', leaked); | |
| 372 | 373 | fail('Unknown global found'); | |
| 373 | 374 | } | |
| 374 | 375 | }); | |
| 375 | 376 | ||
| 376 | 377 | ||
| 377 | - var mustCallChecks = []; | ||
| 378 | + const mustCallChecks = []; | ||
| 378 | 379 | ||
| 379 | 380 | ||
| 380 | 381 | function runCallChecks(exitCode) { | |
| 381 | 382 | if (exitCode !== 0) return; | |
| 382 | 383 | ||
| 383 | - var failed = mustCallChecks.filter(function(context) { | ||
| 384 | + const failed = mustCallChecks.filter(function(context) { | ||
| 384 | 385 | return context.actual !== context.expected; | |
| 385 | 386 | }); | |
| 386 | 387 | ||
@@ -399,7 +400,7 @@ function runCallChecks(exitCode) { | |||
| 399 | 400 | exports.mustCall = function(fn, expected) { | |
| 400 | 401 | if (typeof expected !== 'number') expected = 1; | |
| 401 | 402 | ||
| 402 | - var context = { | ||
| 403 | + const context = { | ||
| 403 | 404 | expected: expected, | |
| 404 | 405 | actual: 0, | |
| 405 | 406 | stack: (new Error()).stack, | |
@@ -418,9 +419,9 @@ exports.mustCall = function(fn, expected) { | |||
| 418 | 419 | }; | |
| 419 | 420 | ||
| 420 | 421 | exports.hasMultiLocalhost = function hasMultiLocalhost() { | |
| 421 | - var TCP = process.binding('tcp_wrap').TCP; | ||
| 422 | - var t = new TCP(); | ||
| 423 | - var ret = t.bind('127.0.0.2', exports.PORT); | ||
| 422 | + const TCP = process.binding('tcp_wrap').TCP; | ||
| 423 | + const t = new TCP(); | ||
| 424 | + const ret = t.bind('127.0.0.2', exports.PORT); | ||
| 424 | 425 | t.close(); | |
| 425 | 426 | return ret === 0; | |
| 426 | 427 | }; | |
@@ -466,7 +467,7 @@ ArrayStream.prototype.write = function() {}; | |||
| 466 | 467 | exports.nodeProcessAborted = function nodeProcessAborted(exitCode, signal) { | |
| 467 | 468 | // Depending on the compiler used, node will exit with either | |
| 468 | 469 | // exit code 132 (SIGILL), 133 (SIGTRAP) or 134 (SIGABRT). | |
| 469 | - var expectedExitCodes = [132, 133, 134]; | ||
| 470 | + let expectedExitCodes = [132, 133, 134]; | ||
| 470 | 471 | ||
| 471 | 472 | // On platforms using KSH as the default shell (like SmartOS), | |
| 472 | 473 | // when a process aborts, KSH exits with an exit code that is | |
@@ -495,8 +496,8 @@ exports.nodeProcessAborted = function nodeProcessAborted(exitCode, signal) { | |||
| 495 | 496 | }; | |
| 496 | 497 | ||
| 497 | 498 | exports.busyLoop = function busyLoop(time) { | |
| 498 | - var startTime = Timer.now(); | ||
| 499 | - var stopTime = startTime + time; | ||
| 499 | + const startTime = Timer.now(); | ||
| 500 | + const stopTime = startTime + time; | ||
| 500 | 501 | while (Timer.now() < stopTime) {} | |
| 501 | 502 | }; | |
| 502 | 503 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments