mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
3d2aef3979
Use assert.strictEqual instead of assert.equal in tests, manually convert types where necessary. PR-URL: https://github.com/nodejs/node/pull/10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
37 lines
1001 B
JavaScript
37 lines
1001 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const execFile = require('child_process').execFile;
|
|
|
|
if (process.argv[2] === 'child') {
|
|
setImmediate(function() {
|
|
require('fs').readFileSync(__filename);
|
|
process.exit();
|
|
});
|
|
|
|
} else {
|
|
(function runTest(flags) {
|
|
const execArgv = [flags.pop()];
|
|
let args = [__filename, 'child'];
|
|
let cntr = 0;
|
|
args = execArgv.concat(args);
|
|
if (!args[0]) args.shift();
|
|
execFile(process.execPath, args, function(err, stdout, stderr) {
|
|
assert.strictEqual(err, null);
|
|
assert.strictEqual(stdout, '');
|
|
if (/WARNING[\s\S]*fs\.readFileSync/.test(stderr))
|
|
cntr++;
|
|
if (args[0] === '--trace-sync-io') {
|
|
assert.strictEqual(cntr, 1);
|
|
} else if (args[0] === __filename) {
|
|
assert.strictEqual(cntr, 0);
|
|
} else {
|
|
throw new Error('UNREACHABLE');
|
|
}
|
|
if (flags.length > 0)
|
|
setImmediate(runTest, flags);
|
|
});
|
|
}(['--trace-sync-io', '']));
|
|
}
|