test: use destructuring on require

PR-URL: https://github.com/nodejs/node/pull/24455
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Juan José Arboleda 2018-11-17 16:38:44 -05:00 committed by Anna Henningsen
parent 4270c13426
commit e0893f03c3
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9

View File

@ -17,9 +17,9 @@ if (isCPPSymbolsNotMapped) {
const assert = require('assert'); const assert = require('assert');
const cp = require('child_process'); const { spawn, spawnSync } = require('child_process');
const path = require('path'); const path = require('path');
const fs = require('fs'); const { writeFileSync } = require('fs');
const LOG_FILE = path.join(tmpdir.path, 'tick-processor.log'); const LOG_FILE = path.join(tmpdir.path, 'tick-processor.log');
const RETRY_TIMEOUT = 150; const RETRY_TIMEOUT = 150;
@ -33,7 +33,7 @@ const code = `function f() {
}; };
f();`; f();`;
const proc = cp.spawn(process.execPath, [ const proc = spawn(process.execPath, [
'--no_logfile_per_isolate', '--no_logfile_per_isolate',
'--logfile=-', '--logfile=-',
'--prof', '--prof',
@ -49,8 +49,8 @@ proc.stdout.on('data', (chunk) => ticks += chunk);
function runPolyfill(content) { function runPolyfill(content) {
proc.kill(); proc.kill();
content += BROKEN_PART; content += BROKEN_PART;
fs.writeFileSync(LOG_FILE, content); writeFileSync(LOG_FILE, content);
const child = cp.spawnSync( const child = spawnSync(
`${process.execPath}`, `${process.execPath}`,
[ [
'--prof-process', LOG_FILE '--prof-process', LOG_FILE