test: remove common.fail()
common.fail() was added to paste over issues with assert.fail() function signature. assert.fail() has been updated to accept a single argument so common.fail() is no longer necessary. PR-URL: https://github.com/nodejs/node/pull/12293 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
6f202ef857
commit
06c29a66d4
@ -246,12 +246,6 @@ Checks whether `IPv6` is supported on this platform.
|
|||||||
|
|
||||||
Checks if there are multiple localhosts available.
|
Checks if there are multiple localhosts available.
|
||||||
|
|
||||||
### fail(msg)
|
|
||||||
* `msg` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
|
|
||||||
* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)
|
|
||||||
|
|
||||||
Throws an `AssertionError` with `msg`
|
|
||||||
|
|
||||||
### fileExists(pathname)
|
### fileExists(pathname)
|
||||||
* pathname [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
|
* pathname [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
|
||||||
* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)
|
* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)
|
||||||
|
@ -404,7 +404,7 @@ process.on('exit', function() {
|
|||||||
if (!exports.globalCheck) return;
|
if (!exports.globalCheck) return;
|
||||||
const leaked = leakedGlobals();
|
const leaked = leakedGlobals();
|
||||||
if (leaked.length > 0) {
|
if (leaked.length > 0) {
|
||||||
fail(`Unexpected global(s) found: ${leaked.join(', ')}`);
|
assert.fail(`Unexpected global(s) found: ${leaked.join(', ')}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -507,14 +507,9 @@ exports.canCreateSymLink = function() {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
function fail(msg) {
|
|
||||||
assert.fail(null, null, msg);
|
|
||||||
}
|
|
||||||
exports.fail = fail;
|
|
||||||
|
|
||||||
exports.mustNotCall = function(msg) {
|
exports.mustNotCall = function(msg) {
|
||||||
return function mustNotCall() {
|
return function mustNotCall() {
|
||||||
fail(msg || 'function should not have been called');
|
assert.fail(msg || 'function should not have been called');
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -627,7 +622,7 @@ exports.WPT = {
|
|||||||
},
|
},
|
||||||
assert_array_equals: assert.deepStrictEqual,
|
assert_array_equals: assert.deepStrictEqual,
|
||||||
assert_unreached(desc) {
|
assert_unreached(desc) {
|
||||||
assert.fail(undefined, undefined, `Reached unreachable code: ${desc}`);
|
assert.fail(`Reached unreachable code: ${desc}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ TestSession.prototype.sendInspectorCommands = function(commands) {
|
|||||||
for (const id in this.messages_) {
|
for (const id in this.messages_) {
|
||||||
s += id + ', ';
|
s += id + ', ';
|
||||||
}
|
}
|
||||||
common.fail('Messages without response: ' +
|
assert.fail('Messages without response: ' +
|
||||||
s.substring(0, s.length - 2));
|
s.substring(0, s.length - 2));
|
||||||
}, TIMEOUT);
|
}, TIMEOUT);
|
||||||
});
|
});
|
||||||
|
@ -28,7 +28,7 @@ function callbackOnly(err) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onEvent(err) {
|
function onEvent(err) {
|
||||||
common.fail('Error should not be emitted if there is callback');
|
assert.fail('Error should not be emitted if there is callback');
|
||||||
}
|
}
|
||||||
|
|
||||||
function onError(err) {
|
function onError(err) {
|
||||||
|
@ -453,7 +453,7 @@ TEST(function test_lookup_all_mixed(done) {
|
|||||||
else if (isIPv6(ip.address))
|
else if (isIPv6(ip.address))
|
||||||
assert.strictEqual(ip.family, 6);
|
assert.strictEqual(ip.family, 6);
|
||||||
else
|
else
|
||||||
common.fail('unexpected IP address');
|
assert.fail('unexpected IP address');
|
||||||
});
|
});
|
||||||
|
|
||||||
done();
|
done();
|
||||||
|
@ -38,7 +38,7 @@ tls.connect(opts, fail).on('error', common.mustCall((err) => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
function fail() {
|
function fail() {
|
||||||
common.fail('should fail to connect');
|
assert.fail('should fail to connect');
|
||||||
}
|
}
|
||||||
|
|
||||||
// New secure contexts have the well-known root CAs.
|
// New secure contexts have the well-known root CAs.
|
||||||
|
@ -20,10 +20,11 @@
|
|||||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
require('../common');
|
||||||
|
const assert = require('assert');
|
||||||
|
|
||||||
process.on('beforeExit', function() {
|
process.on('beforeExit', function() {
|
||||||
common.fail('exit should not allow this to occur');
|
assert.fail('exit should not allow this to occur');
|
||||||
});
|
});
|
||||||
|
|
||||||
process.exit();
|
process.exit();
|
||||||
|
@ -37,7 +37,7 @@ switch (process.argv[2] || '') {
|
|||||||
case 'spawn':
|
case 'spawn':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
common.fail();
|
assert.fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkExit(statusCode) {
|
function checkExit(statusCode) {
|
||||||
|
@ -42,7 +42,7 @@ if (process.argv[2] === 'child') {
|
|||||||
|
|
||||||
child.stderr.setEncoding('utf8');
|
child.stderr.setEncoding('utf8');
|
||||||
child.stderr.on('data', function(data) {
|
child.stderr.on('data', function(data) {
|
||||||
common.fail(`Unexpected parent stderr: ${data}`);
|
assert.fail(`Unexpected parent stderr: ${data}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
// check if we receive both 'hello' at start and 'goodbye' at end
|
// check if we receive both 'hello' at start and 'goodbye' at end
|
||||||
|
@ -51,7 +51,7 @@ if (cluster.isMaster) {
|
|||||||
setTimeout(function() { client.end(); }, 50);
|
setTimeout(function() { client.end(); }, 50);
|
||||||
}).on('error', function(e) {
|
}).on('error', function(e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
common.fail('server.listen failed');
|
assert.fail('server.listen failed');
|
||||||
cluster.worker.disconnect();
|
cluster.worker.disconnect();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,8 @@ assert.throws(function() {
|
|||||||
}, /^TypeError: Invalid expected value: \/foo\/$/);
|
}, /^TypeError: Invalid expected value: \/foo\/$/);
|
||||||
|
|
||||||
|
|
||||||
// common.fail() tests
|
// assert.fail() tests
|
||||||
assert.throws(
|
assert.throws(
|
||||||
() => { common.fail('fhqwhgads'); },
|
() => { assert.fail('fhqwhgads'); },
|
||||||
/^AssertionError: fhqwhgads$/
|
/^AssertionError: fhqwhgads$/
|
||||||
);
|
);
|
||||||
|
@ -41,7 +41,7 @@ const dgram = require('dgram');
|
|||||||
|
|
||||||
socket.on('error', (err) => {
|
socket.on('error', (err) => {
|
||||||
socket.close();
|
socket.close();
|
||||||
common.fail(`Unexpected error on udp4 socket. ${err.toString()}`);
|
assert.fail(`Unexpected error on udp4 socket. ${err.toString()}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.bind(0, common.localhostIPv4);
|
socket.bind(0, common.localhostIPv4);
|
||||||
@ -65,7 +65,7 @@ if (common.hasIPv6) {
|
|||||||
|
|
||||||
socket.on('error', (err) => {
|
socket.on('error', (err) => {
|
||||||
socket.close();
|
socket.close();
|
||||||
common.fail(`Unexpected error on udp6 socket. ${err.toString()}`);
|
assert.fail(`Unexpected error on udp6 socket. ${err.toString()}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.bind(0, localhost);
|
socket.bind(0, localhost);
|
||||||
|
@ -40,7 +40,7 @@ socket.on('error', (err) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
common.fail(`Unexpected error: ${err}`);
|
assert.fail(`Unexpected error: ${err}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Initiate a few send() operations, which will fail.
|
// Initiate a few send() operations, which will fail.
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
|
const assert = require('assert');
|
||||||
const domain = require('domain');
|
const domain = require('domain');
|
||||||
const child_process = require('child_process');
|
const child_process = require('child_process');
|
||||||
|
|
||||||
@ -183,14 +184,14 @@ if (process.argv[2] === 'child') {
|
|||||||
test.expectedMessages.forEach(function(expectedMessage) {
|
test.expectedMessages.forEach(function(expectedMessage) {
|
||||||
if (test.messagesReceived === undefined ||
|
if (test.messagesReceived === undefined ||
|
||||||
test.messagesReceived.indexOf(expectedMessage) === -1)
|
test.messagesReceived.indexOf(expectedMessage) === -1)
|
||||||
common.fail('test ' + test.fn.name + ' should have sent message: ' +
|
assert.fail('test ' + test.fn.name + ' should have sent message: ' +
|
||||||
expectedMessage + ' but didn\'t');
|
expectedMessage + ' but didn\'t');
|
||||||
});
|
});
|
||||||
|
|
||||||
if (test.messagesReceived) {
|
if (test.messagesReceived) {
|
||||||
test.messagesReceived.forEach(function(receivedMessage) {
|
test.messagesReceived.forEach(function(receivedMessage) {
|
||||||
if (test.expectedMessages.indexOf(receivedMessage) === -1) {
|
if (test.expectedMessages.indexOf(receivedMessage) === -1) {
|
||||||
common.fail('test ' + test.fn.name +
|
assert.fail('test ' + test.fn.name +
|
||||||
' should not have sent message: ' + receivedMessage +
|
' should not have sent message: ' + receivedMessage +
|
||||||
' but did');
|
' but did');
|
||||||
}
|
}
|
||||||
|
@ -53,9 +53,9 @@ const EventEmitter = require('events');
|
|||||||
});
|
});
|
||||||
|
|
||||||
ee.on('hello', hello);
|
ee.on('hello', hello);
|
||||||
ee.once('foo', common.fail);
|
ee.once('foo', assert.fail);
|
||||||
assert.deepStrictEqual(['hello', 'foo'], events_new_listener_emitted);
|
assert.deepStrictEqual(['hello', 'foo'], events_new_listener_emitted);
|
||||||
assert.deepStrictEqual([hello, common.fail], listeners_new_listener_emitted);
|
assert.deepStrictEqual([hello, assert.fail], listeners_new_listener_emitted);
|
||||||
|
|
||||||
ee.emit('hello', 'a', 'b');
|
ee.emit('hello', 'a', 'b');
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const common = require('../common');
|
require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
const EventEmitter = require('events').EventEmitter;
|
const EventEmitter = require('events').EventEmitter;
|
||||||
@ -35,12 +35,12 @@ assert.strictEqual(fl.length, 0);
|
|||||||
assert(!(e._events instanceof Object));
|
assert(!(e._events instanceof Object));
|
||||||
assert.deepStrictEqual(Object.keys(e._events), []);
|
assert.deepStrictEqual(Object.keys(e._events), []);
|
||||||
|
|
||||||
e.on('foo', common.fail);
|
e.on('foo', assert.fail);
|
||||||
fl = e.listeners('foo');
|
fl = e.listeners('foo');
|
||||||
assert.strictEqual(e._events.foo, common.fail);
|
assert.strictEqual(e._events.foo, assert.fail);
|
||||||
assert(Array.isArray(fl));
|
assert(Array.isArray(fl));
|
||||||
assert.strictEqual(fl.length, 1);
|
assert.strictEqual(fl.length, 1);
|
||||||
assert.strictEqual(fl[0], common.fail);
|
assert.strictEqual(fl[0], assert.fail);
|
||||||
|
|
||||||
e.listeners('bar');
|
e.listeners('bar');
|
||||||
|
|
||||||
@ -49,12 +49,12 @@ fl = e.listeners('foo');
|
|||||||
|
|
||||||
assert(Array.isArray(e._events.foo));
|
assert(Array.isArray(e._events.foo));
|
||||||
assert.strictEqual(e._events.foo.length, 2);
|
assert.strictEqual(e._events.foo.length, 2);
|
||||||
assert.strictEqual(e._events.foo[0], common.fail);
|
assert.strictEqual(e._events.foo[0], assert.fail);
|
||||||
assert.strictEqual(e._events.foo[1], assert.ok);
|
assert.strictEqual(e._events.foo[1], assert.ok);
|
||||||
|
|
||||||
assert(Array.isArray(fl));
|
assert(Array.isArray(fl));
|
||||||
assert.strictEqual(fl.length, 2);
|
assert.strictEqual(fl.length, 2);
|
||||||
assert.strictEqual(fl[0], common.fail);
|
assert.strictEqual(fl[0], assert.fail);
|
||||||
assert.strictEqual(fl[1], assert.ok);
|
assert.strictEqual(fl[1], assert.ok);
|
||||||
|
|
||||||
console.log('ok');
|
console.log('ok');
|
||||||
|
@ -34,7 +34,7 @@ e.emit('hello', 'a', 'b');
|
|||||||
e.emit('hello', 'a', 'b');
|
e.emit('hello', 'a', 'b');
|
||||||
|
|
||||||
const remove = function() {
|
const remove = function() {
|
||||||
common.fail('once->foo should not be emitted');
|
assert.fail('once->foo should not be emitted');
|
||||||
};
|
};
|
||||||
|
|
||||||
e.once('foo', remove);
|
e.once('foo', remove);
|
||||||
|
@ -70,11 +70,11 @@ function listener2() {}
|
|||||||
const ee = new EventEmitter();
|
const ee = new EventEmitter();
|
||||||
|
|
||||||
function remove1() {
|
function remove1() {
|
||||||
common.fail('remove1 should not have been called');
|
assert.fail('remove1 should not have been called');
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove2() {
|
function remove2() {
|
||||||
common.fail('remove2 should not have been called');
|
assert.fail('remove2 should not have been called');
|
||||||
}
|
}
|
||||||
|
|
||||||
ee.on('removeListener', common.mustCall(function(name, cb) {
|
ee.on('removeListener', common.mustCall(function(name, cb) {
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
|
const assert = require('assert');
|
||||||
|
|
||||||
process.on('uncaughtException', function(err) {
|
process.on('uncaughtException', function(err) {
|
||||||
console.log('Caught exception: ' + err);
|
console.log('Caught exception: ' + err);
|
||||||
@ -32,4 +33,4 @@ setTimeout(common.mustCall(function() {
|
|||||||
|
|
||||||
// Intentionally cause an exception, but don't catch it.
|
// Intentionally cause an exception, but don't catch it.
|
||||||
nonexistentFunc(); // eslint-disable-line no-undef
|
nonexistentFunc(); // eslint-disable-line no-undef
|
||||||
common.fail('This will not run.');
|
assert.fail('This will not run.');
|
||||||
|
@ -95,10 +95,10 @@ check(fs.symlink, fs.symlinkSync, fileUrl, 'foobar');
|
|||||||
check(fs.symlink, fs.symlinkSync, 'foobar', fileUrl);
|
check(fs.symlink, fs.symlinkSync, 'foobar', fileUrl);
|
||||||
check(fs.truncate, fs.truncateSync, fileUrl);
|
check(fs.truncate, fs.truncateSync, fileUrl);
|
||||||
check(fs.unlink, fs.unlinkSync, fileUrl);
|
check(fs.unlink, fs.unlinkSync, fileUrl);
|
||||||
check(null, fs.unwatchFile, fileUrl, common.fail);
|
check(null, fs.unwatchFile, fileUrl, assert.fail);
|
||||||
check(fs.utimes, fs.utimesSync, fileUrl, 0, 0);
|
check(fs.utimes, fs.utimesSync, fileUrl, 0, 0);
|
||||||
check(null, fs.watch, fileUrl, common.fail);
|
check(null, fs.watch, fileUrl, assert.fail);
|
||||||
check(null, fs.watchFile, fileUrl, common.fail);
|
check(null, fs.watchFile, fileUrl, assert.fail);
|
||||||
check(fs.writeFile, fs.writeFileSync, fileUrl, 'abc');
|
check(fs.writeFile, fs.writeFileSync, fileUrl, 'abc');
|
||||||
|
|
||||||
check(fs.access, fs.accessSync, fileUrl2);
|
check(fs.access, fs.accessSync, fileUrl2);
|
||||||
@ -123,10 +123,10 @@ check(fs.symlink, fs.symlinkSync, fileUrl2, 'foobar');
|
|||||||
check(fs.symlink, fs.symlinkSync, 'foobar', fileUrl2);
|
check(fs.symlink, fs.symlinkSync, 'foobar', fileUrl2);
|
||||||
check(fs.truncate, fs.truncateSync, fileUrl2);
|
check(fs.truncate, fs.truncateSync, fileUrl2);
|
||||||
check(fs.unlink, fs.unlinkSync, fileUrl2);
|
check(fs.unlink, fs.unlinkSync, fileUrl2);
|
||||||
check(null, fs.unwatchFile, fileUrl2, common.fail);
|
check(null, fs.unwatchFile, fileUrl2, assert.fail);
|
||||||
check(fs.utimes, fs.utimesSync, fileUrl2, 0, 0);
|
check(fs.utimes, fs.utimesSync, fileUrl2, 0, 0);
|
||||||
check(null, fs.watch, fileUrl2, common.fail);
|
check(null, fs.watch, fileUrl2, assert.fail);
|
||||||
check(null, fs.watchFile, fileUrl2, common.fail);
|
check(null, fs.watchFile, fileUrl2, assert.fail);
|
||||||
check(fs.writeFile, fs.writeFileSync, fileUrl2, 'abc');
|
check(fs.writeFile, fs.writeFileSync, fileUrl2, 'abc');
|
||||||
|
|
||||||
// an 'error' for exists means that it doesn't exist.
|
// an 'error' for exists means that it doesn't exist.
|
||||||
|
@ -62,7 +62,7 @@ fs.open('.', 'r', undefined, common.mustCall(function(err, fd) {
|
|||||||
try {
|
try {
|
||||||
stats = fs.fstatSync(fd);
|
stats = fs.fstatSync(fd);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
common.fail(err);
|
assert.fail(err);
|
||||||
}
|
}
|
||||||
if (stats) {
|
if (stats) {
|
||||||
console.dir(stats);
|
console.dir(stats);
|
||||||
|
@ -44,7 +44,7 @@ common.refreshTmpDir();
|
|||||||
const stream = fs.createWriteStream(file);
|
const stream = fs.createWriteStream(file);
|
||||||
|
|
||||||
stream.on('drain', function() {
|
stream.on('drain', function() {
|
||||||
common.fail('\'drain\' event must not be emitted before ' +
|
assert.fail('\'drain\' event must not be emitted before ' +
|
||||||
'stream.write() has been called at least once.');
|
'stream.write() has been called at least once.');
|
||||||
});
|
});
|
||||||
stream.destroy();
|
stream.destroy();
|
||||||
|
@ -26,7 +26,7 @@ process.stderr.write = (data) => {
|
|||||||
if (write_calls === 0)
|
if (write_calls === 0)
|
||||||
assert.ok(data.match(leak_warning));
|
assert.ok(data.match(leak_warning));
|
||||||
else
|
else
|
||||||
common.fail('stderr.write should be called only once');
|
assert.fail('stderr.write should be called only once');
|
||||||
|
|
||||||
write_calls++;
|
write_calls++;
|
||||||
};
|
};
|
||||||
|
@ -42,7 +42,7 @@ const server = http.createServer(common.mustCall(function(req, res) {
|
|||||||
res.resume();
|
res.resume();
|
||||||
fn = common.mustCall(createConnectionError);
|
fn = common.mustCall(createConnectionError);
|
||||||
http.get({ createConnection: fn }, function(res) {
|
http.get({ createConnection: fn }, function(res) {
|
||||||
common.fail('Unexpected response callback');
|
assert.fail('Unexpected response callback');
|
||||||
}).on('error', common.mustCall(function(err) {
|
}).on('error', common.mustCall(function(err) {
|
||||||
assert.strictEqual(err.message, 'Could not create socket');
|
assert.strictEqual(err.message, 'Could not create socket');
|
||||||
server.close();
|
server.close();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
|
|
||||||
@ -8,7 +8,7 @@ const theExperimentallyDeterminedNumber = 39;
|
|||||||
|
|
||||||
function fail(path) {
|
function fail(path) {
|
||||||
assert.throws(() => {
|
assert.throws(() => {
|
||||||
http.request({ path }, common.fail);
|
http.request({ path }, assert.fail);
|
||||||
}, expectedError);
|
}, expectedError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
|
const assert = require('assert');
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
|
|
||||||
const invalidLocalAddress = '1.2.3.4';
|
const invalidLocalAddress = '1.2.3.4';
|
||||||
@ -43,7 +44,7 @@ server.listen(0, '127.0.0.1', common.mustCall(function() {
|
|||||||
method: 'GET',
|
method: 'GET',
|
||||||
localAddress: invalidLocalAddress
|
localAddress: invalidLocalAddress
|
||||||
}, function(res) {
|
}, function(res) {
|
||||||
common.fail('unexpectedly got response from server');
|
assert.fail('unexpectedly got response from server');
|
||||||
}).on('error', common.mustCall(function(e) {
|
}).on('error', common.mustCall(function(e) {
|
||||||
console.log('client got error: ' + e.message);
|
console.log('client got error: ' + e.message);
|
||||||
server.close();
|
server.close();
|
||||||
|
@ -127,7 +127,7 @@ const s = http.createServer(common.mustCall((req, res) => {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
common.fail('Unknown test');
|
assert.fail('Unknown test');
|
||||||
}
|
}
|
||||||
|
|
||||||
res.statusCode = 201;
|
res.statusCode = 201;
|
||||||
@ -174,7 +174,7 @@ function nextTest() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
common.fail('Unknown test');
|
assert.fail('Unknown test');
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setEncoding('utf8');
|
response.setEncoding('utf8');
|
||||||
|
@ -19,7 +19,7 @@ const server = http.createServer((req, res) => {
|
|||||||
res.writeHead(200, {'content-length': [1, 2]});
|
res.writeHead(200, {'content-length': [1, 2]});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
common.fail('should never get here');
|
assert.fail('should never get here');
|
||||||
}
|
}
|
||||||
res.end('ok');
|
res.end('ok');
|
||||||
});
|
});
|
||||||
@ -35,7 +35,7 @@ server.listen(0, common.mustCall(() => {
|
|||||||
http.get(
|
http.get(
|
||||||
{port: server.address().port, headers: {'x-num': n}},
|
{port: server.address().port, headers: {'x-num': n}},
|
||||||
(res) => {
|
(res) => {
|
||||||
common.fail('client allowed multiple content-length headers.');
|
assert.fail('client allowed multiple content-length headers.');
|
||||||
}
|
}
|
||||||
).on('error', common.mustCall((err) => {
|
).on('error', common.mustCall((err) => {
|
||||||
assert(/^Parse Error/.test(err.message));
|
assert(/^Parse Error/.test(err.message));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const common = require('../common');
|
require('../common');
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
const net = require('net');
|
const net = require('net');
|
||||||
const url = require('url');
|
const url = require('url');
|
||||||
@ -38,7 +38,7 @@ const server = http.createServer((req, res) => {
|
|||||||
test(res, 200, {'foo': y});
|
test(res, 200, {'foo': y});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
common.fail('should not get to here.');
|
assert.fail('should not get to here.');
|
||||||
}
|
}
|
||||||
if (count === 3)
|
if (count === 3)
|
||||||
server.close();
|
server.close();
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
const net = require('net');
|
const net = require('net');
|
||||||
@ -44,7 +44,7 @@ testCases.findByPath = function(path) {
|
|||||||
return testCase.path === path;
|
return testCase.path === path;
|
||||||
});
|
});
|
||||||
if (matching.length === 0) {
|
if (matching.length === 0) {
|
||||||
common.fail(`failed to find test case with path ${path}`);
|
assert.fail(`failed to find test case with path ${path}`);
|
||||||
}
|
}
|
||||||
return matching[0];
|
return matching[0];
|
||||||
};
|
};
|
||||||
|
@ -23,7 +23,7 @@ server.listen(0, () => {
|
|||||||
client.on('data', (data) => {
|
client.on('data', (data) => {
|
||||||
// Should not get to this point because the server should simply
|
// Should not get to this point because the server should simply
|
||||||
// close the connection without returning any data.
|
// close the connection without returning any data.
|
||||||
common.fail('no data should be returned by the server');
|
assert.fail('no data should be returned by the server');
|
||||||
});
|
});
|
||||||
client.on('end', common.mustCall());
|
client.on('end', common.mustCall());
|
||||||
});
|
});
|
||||||
|
@ -66,7 +66,7 @@ server.listen(common.PIPE, common.mustCall(function() {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
req.on('error', function(e) {
|
req.on('error', function(e) {
|
||||||
common.fail(e.stack);
|
assert.fail(e.stack);
|
||||||
});
|
});
|
||||||
|
|
||||||
req.end();
|
req.end();
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
|
const assert = require('assert');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
if (!common.hasCrypto) {
|
if (!common.hasCrypto) {
|
||||||
@ -54,7 +55,7 @@ server.listen(0, '127.0.0.1', common.mustCall(function() {
|
|||||||
method: 'GET',
|
method: 'GET',
|
||||||
localAddress: invalidLocalAddress
|
localAddress: invalidLocalAddress
|
||||||
}, function(res) {
|
}, function(res) {
|
||||||
common.fail('unexpectedly got response from server');
|
assert.fail('unexpectedly got response from server');
|
||||||
}).on('error', common.mustCall(function(e) {
|
}).on('error', common.mustCall(function(e) {
|
||||||
console.log('client got error: ' + e.message);
|
console.log('client got error: ' + e.message);
|
||||||
server.close();
|
server.close();
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const net = require('net');
|
const net = require('net');
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ const srv = net.createServer(function onConnection(conn) {
|
|||||||
conn.on('error', function(err) {
|
conn.on('error', function(err) {
|
||||||
errs.push(err);
|
errs.push(err);
|
||||||
if (errs.length > 1 && errs[0] === errs[1])
|
if (errs.length > 1 && errs[0] === errs[1])
|
||||||
common.fail('Should not emit the same error twice');
|
assert.fail('Should not emit the same error twice');
|
||||||
});
|
});
|
||||||
conn.on('close', function() {
|
conn.on('close', function() {
|
||||||
srv.unref();
|
srv.unref();
|
||||||
|
@ -56,7 +56,7 @@ if (common.isWindows) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const notSocketClient = net.createConnection(emptyTxt, function() {
|
const notSocketClient = net.createConnection(emptyTxt, function() {
|
||||||
common.fail('connection callback should not run');
|
assert.fail('connection callback should not run');
|
||||||
});
|
});
|
||||||
|
|
||||||
notSocketClient.on('error', common.mustCall(function(err) {
|
notSocketClient.on('error', common.mustCall(function(err) {
|
||||||
@ -67,7 +67,7 @@ notSocketClient.on('error', common.mustCall(function(err) {
|
|||||||
|
|
||||||
// Trying to connect to not-existing socket should result in ENOENT error
|
// Trying to connect to not-existing socket should result in ENOENT error
|
||||||
const noEntSocketClient = net.createConnection('no-ent-file', function() {
|
const noEntSocketClient = net.createConnection('no-ent-file', function() {
|
||||||
common.fail('connection to non-existent socket, callback should not run');
|
assert.fail('connection to non-existent socket, callback should not run');
|
||||||
});
|
});
|
||||||
|
|
||||||
noEntSocketClient.on('error', common.mustCall(function(err) {
|
noEntSocketClient.on('error', common.mustCall(function(err) {
|
||||||
@ -84,7 +84,7 @@ if (!common.isWindows && process.getuid() !== 0) {
|
|||||||
fs.chmodSync(common.PIPE, 0);
|
fs.chmodSync(common.PIPE, 0);
|
||||||
|
|
||||||
const accessClient = net.createConnection(common.PIPE, function() {
|
const accessClient = net.createConnection(common.PIPE, function() {
|
||||||
common.fail('connection should get EACCES, callback should not run');
|
assert.fail('connection should get EACCES, callback should not run');
|
||||||
});
|
});
|
||||||
|
|
||||||
accessClient.on('error', common.mustCall(function(err) {
|
accessClient.on('error', common.mustCall(function(err) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
const net = require('net');
|
const net = require('net');
|
||||||
@ -86,5 +86,5 @@ process.on('exit', function() {
|
|||||||
|
|
||||||
process.on('unhandledRejection', function() {
|
process.on('unhandledRejection', function() {
|
||||||
console.error('promise rejected');
|
console.error('promise rejected');
|
||||||
common.fail('A promise in the chain rejected');
|
assert.fail('A promise in the chain rejected');
|
||||||
});
|
});
|
||||||
|
@ -31,7 +31,7 @@ let server1Sock;
|
|||||||
const server1ConnHandler = function(socket) {
|
const server1ConnHandler = function(socket) {
|
||||||
socket.on('data', function(data) {
|
socket.on('data', function(data) {
|
||||||
if (stopped) {
|
if (stopped) {
|
||||||
common.fail('data event should not have happened yet');
|
assert.fail('data event should not have happened yet');
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.strictEqual(data.toString(), msg, 'invalid data received');
|
assert.strictEqual(data.toString(), msg, 'invalid data received');
|
||||||
|
@ -34,7 +34,7 @@ const server = net.createServer(function(socket) {
|
|||||||
socket.setNoDelay();
|
socket.setNoDelay();
|
||||||
socket.setTimeout(9999);
|
socket.setTimeout(9999);
|
||||||
socket.on('timeout', function() {
|
socket.on('timeout', function() {
|
||||||
common.fail(`flushed: ${flushed}, received: ${received}/${SIZE * N}`);
|
assert.fail(`flushed: ${flushed}, received: ${received}/${SIZE * N}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
for (let i = 0; i < N; ++i) {
|
for (let i = 0; i < N; ++i) {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const common = require('../common');
|
require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
process.on('exit', () => {
|
process.on('exit', () => {
|
||||||
assert.strictEqual(process._exiting, true, 'process._exiting was not set!');
|
assert.strictEqual(process._exiting, true, 'process._exiting was not set!');
|
||||||
|
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
common.fail('process is exiting, should not be called.');
|
assert.fail('process is exiting, should not be called.');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -21,9 +21,10 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
|
const assert = require('assert');
|
||||||
|
|
||||||
process.on('beforeExit', common.mustCall(function() {
|
process.on('beforeExit', common.mustCall(function() {
|
||||||
setTimeout(common.mustNotCall(), 5);
|
setTimeout(common.mustNotCall(), 5);
|
||||||
process.exit(0); // Should execute immediately even if we schedule new work.
|
process.exit(0); // Should execute immediately even if we schedule new work.
|
||||||
common.fail();
|
assert.fail();
|
||||||
}));
|
}));
|
||||||
|
@ -10,7 +10,7 @@ process.noDeprecation = true;
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
function listener() {
|
function listener() {
|
||||||
common.fail('received unexpected warning');
|
assert.fail('received unexpected warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
process.addListener('warning', listener);
|
process.addListener('warning', listener);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const domain = require('domain');
|
const domain = require('domain');
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ asyncTest('Catching a promise rejection after setImmediate is not' +
|
|||||||
});
|
});
|
||||||
_reject(e);
|
_reject(e);
|
||||||
setImmediate(function() {
|
setImmediate(function() {
|
||||||
promise.then(common.fail, function() {});
|
promise.then(assert.fail, function() {});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ asyncTest('When re-throwing new errors in a promise catch, only the' +
|
|||||||
assert.strictEqual(e2, reason);
|
assert.strictEqual(e2, reason);
|
||||||
assert.strictEqual(promise2, promise);
|
assert.strictEqual(promise2, promise);
|
||||||
});
|
});
|
||||||
const promise2 = Promise.reject(e).then(common.fail, function(reason) {
|
const promise2 = Promise.reject(e).then(assert.fail, function(reason) {
|
||||||
assert.strictEqual(e, reason);
|
assert.strictEqual(e, reason);
|
||||||
throw e2;
|
throw e2;
|
||||||
});
|
});
|
||||||
@ -205,7 +205,7 @@ asyncTest('When re-throwing new errors in a promise catch, only the ' +
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
reject(e);
|
reject(e);
|
||||||
}, 1);
|
}, 1);
|
||||||
}).then(common.fail, function(reason) {
|
}).then(assert.fail, function(reason) {
|
||||||
assert.strictEqual(e, reason);
|
assert.strictEqual(e, reason);
|
||||||
throw e2;
|
throw e2;
|
||||||
});
|
});
|
||||||
@ -224,7 +224,7 @@ asyncTest('When re-throwing new errors in a promise catch, only the re-thrown' +
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
reject(e);
|
reject(e);
|
||||||
process.nextTick(function() {
|
process.nextTick(function() {
|
||||||
promise2 = promise.then(common.fail, function(reason) {
|
promise2 = promise.then(assert.fail, function(reason) {
|
||||||
assert.strictEqual(e, reason);
|
assert.strictEqual(e, reason);
|
||||||
throw e2;
|
throw e2;
|
||||||
});
|
});
|
||||||
@ -240,7 +240,7 @@ asyncTest(
|
|||||||
function(done) {
|
function(done) {
|
||||||
const e = new Error();
|
const e = new Error();
|
||||||
onUnhandledFail(done);
|
onUnhandledFail(done);
|
||||||
Promise.reject(e).then(common.fail, function() {});
|
Promise.reject(e).then(assert.fail, function() {});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ asyncTest(
|
|||||||
onUnhandledFail(done);
|
onUnhandledFail(done);
|
||||||
new Promise(function(_, reject) {
|
new Promise(function(_, reject) {
|
||||||
reject(e);
|
reject(e);
|
||||||
}).then(common.fail, function() {});
|
}).then(assert.fail, function() {});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ asyncTest('Attaching a promise catch in a process.nextTick is soon enough to' +
|
|||||||
onUnhandledFail(done);
|
onUnhandledFail(done);
|
||||||
const promise = Promise.reject(e);
|
const promise = Promise.reject(e);
|
||||||
process.nextTick(function() {
|
process.nextTick(function() {
|
||||||
promise.then(common.fail, function() {});
|
promise.then(assert.fail, function() {});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ asyncTest('Attaching a promise catch in a process.nextTick is soon enough to' +
|
|||||||
reject(e);
|
reject(e);
|
||||||
});
|
});
|
||||||
process.nextTick(function() {
|
process.nextTick(function() {
|
||||||
promise.then(common.fail, function() {});
|
promise.then(assert.fail, function() {});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ asyncTest('catching a promise which is asynchronously rejected (via' +
|
|||||||
reject(e);
|
reject(e);
|
||||||
}, 1);
|
}, 1);
|
||||||
});
|
});
|
||||||
}).then(common.fail, function(reason) {
|
}).then(assert.fail, function(reason) {
|
||||||
assert.strictEqual(e, reason);
|
assert.strictEqual(e, reason);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -316,7 +316,7 @@ asyncTest('Catching a rejected promise derived from throwing in a' +
|
|||||||
onUnhandledFail(done);
|
onUnhandledFail(done);
|
||||||
Promise.resolve().then(function() {
|
Promise.resolve().then(function() {
|
||||||
throw e;
|
throw e;
|
||||||
}).then(common.fail, function(reason) {
|
}).then(assert.fail, function(reason) {
|
||||||
assert.strictEqual(e, reason);
|
assert.strictEqual(e, reason);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -328,7 +328,7 @@ asyncTest('Catching a rejected promise derived from returning a' +
|
|||||||
onUnhandledFail(done);
|
onUnhandledFail(done);
|
||||||
Promise.resolve().then(function() {
|
Promise.resolve().then(function() {
|
||||||
return Promise.reject(e);
|
return Promise.reject(e);
|
||||||
}).then(common.fail, function(reason) {
|
}).then(assert.fail, function(reason) {
|
||||||
assert.strictEqual(e, reason);
|
assert.strictEqual(e, reason);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -382,7 +382,7 @@ asyncTest('Catching the Promise.all() of a collection that includes a' +
|
|||||||
'rejected promise prevents unhandledRejection', function(done) {
|
'rejected promise prevents unhandledRejection', function(done) {
|
||||||
const e = new Error();
|
const e = new Error();
|
||||||
onUnhandledFail(done);
|
onUnhandledFail(done);
|
||||||
Promise.all([Promise.reject(e)]).then(common.fail, function() {});
|
Promise.all([Promise.reject(e)]).then(assert.fail, function() {});
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest(
|
asyncTest(
|
||||||
@ -398,7 +398,7 @@ asyncTest(
|
|||||||
});
|
});
|
||||||
p = Promise.all([p]);
|
p = Promise.all([p]);
|
||||||
process.nextTick(function() {
|
process.nextTick(function() {
|
||||||
p.then(common.fail, function() {});
|
p.then(assert.fail, function() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -434,7 +434,7 @@ asyncTest('Waiting setTimeout(, 10) to catch a promise causes an' +
|
|||||||
throw e;
|
throw e;
|
||||||
});
|
});
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
thePromise.then(common.fail, function(reason) {
|
thePromise.then(assert.fail, function(reason) {
|
||||||
assert.strictEqual(e, reason);
|
assert.strictEqual(e, reason);
|
||||||
});
|
});
|
||||||
}, 10);
|
}, 10);
|
||||||
|
@ -39,7 +39,7 @@ if (!process.argv[2]) {
|
|||||||
|
|
||||||
const comspec = process.env['comspec'];
|
const comspec = process.env['comspec'];
|
||||||
if (!comspec || comspec.length === 0) {
|
if (!comspec || comspec.length === 0) {
|
||||||
common.fail('Failed to get COMSPEC');
|
assert.fail('Failed to get COMSPEC');
|
||||||
}
|
}
|
||||||
|
|
||||||
const args = ['/c', process.execPath, __filename, 'child',
|
const args = ['/c', process.execPath, __filename, 'child',
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
require('../common');
|
||||||
const R = require('_stream_readable');
|
const R = require('_stream_readable');
|
||||||
const W = require('_stream_writable');
|
const W = require('_stream_writable');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
@ -53,5 +53,5 @@ src.on('end', function() {
|
|||||||
src.pipe(dst);
|
src.pipe(dst);
|
||||||
|
|
||||||
const timeout = setTimeout(function() {
|
const timeout = setTimeout(function() {
|
||||||
common.fail('timed out waiting for _write');
|
assert.fail('timed out waiting for _write');
|
||||||
}, 100);
|
}, 100);
|
||||||
|
@ -71,7 +71,7 @@ let clientError = null;
|
|||||||
let connectError = null;
|
let connectError = null;
|
||||||
|
|
||||||
const server = tls.createServer({ ca: ca, cert: cert, key: key }, () => {
|
const server = tls.createServer({ ca: ca, cert: cert, key: key }, () => {
|
||||||
common.fail('should be unreachable');
|
assert.fail('should be unreachable');
|
||||||
}).on('tlsClientError', function(err, conn) {
|
}).on('tlsClientError', function(err, conn) {
|
||||||
assert(!clientError && conn);
|
assert(!clientError && conn);
|
||||||
clientError = err;
|
clientError = err;
|
||||||
|
@ -22,7 +22,7 @@ const options = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const server = tls.createServer(options, (c) => {
|
const server = tls.createServer(options, (c) => {
|
||||||
common.fail('Should not be called');
|
assert.fail('Should not be called');
|
||||||
}).on('tlsClientError', common.mustCall((err, c) => {
|
}).on('tlsClientError', common.mustCall((err, c) => {
|
||||||
assert(/SSL_use_certificate:passed a null parameter/i.test(err.message));
|
assert(/SSL_use_certificate:passed a null parameter/i.test(err.message));
|
||||||
server.close();
|
server.close();
|
||||||
|
@ -140,7 +140,7 @@ function doTest(testOptions, callback) {
|
|||||||
spawnClient();
|
spawnClient();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
common.fail(`code: ${code}, signal: ${signal}, output: ${err}`);
|
assert.fail(`code: ${code}, signal: ${signal}, output: ${err}`);
|
||||||
}
|
}
|
||||||
assert.strictEqual(code, 0);
|
assert.strictEqual(code, 0);
|
||||||
server.close(common.mustCall(function() {
|
server.close(common.mustCall(function() {
|
||||||
|
@ -239,7 +239,7 @@ for (const showHidden of [true, false]) {
|
|||||||
{visible: {value: 1, enumerable: true}, hidden: {value: 2}}), true);
|
{visible: {value: 1, enumerable: true}, hidden: {value: 2}}), true);
|
||||||
if (out !== '{ [hidden]: 2, visible: 1 }' &&
|
if (out !== '{ [hidden]: 2, visible: 1 }' &&
|
||||||
out !== '{ visible: 1, [hidden]: 2 }') {
|
out !== '{ visible: 1, [hidden]: 2 }') {
|
||||||
common.fail(`unexpected value for out ${out}`);
|
assert.fail(`unexpected value for out ${out}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ for (const showHidden of [true, false]) {
|
|||||||
hidden: {value: 'secret'}}), true);
|
hidden: {value: 'secret'}}), true);
|
||||||
if (out !== "{ [hidden]: 'secret', name: 'Tim' }" &&
|
if (out !== "{ [hidden]: 'secret', name: 'Tim' }" &&
|
||||||
out !== "{ name: 'Tim', [hidden]: 'secret' }") {
|
out !== "{ name: 'Tim', [hidden]: 'secret' }") {
|
||||||
common.fail(`unexpected value for out ${out}`);
|
assert.fail(`unexpected value for out ${out}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ assert.throws(function() {
|
|||||||
}, /SyntaxError/);
|
}, /SyntaxError/);
|
||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
vm.runInDebugContext({ toString: common.fail });
|
vm.runInDebugContext({ toString: assert.fail });
|
||||||
}, /AssertionError/);
|
}, /AssertionError/);
|
||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const child_process = require('child_process');
|
const child_process = require('child_process');
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ const p = child_process.spawn(process.execPath, [
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
p.stderr.on('data', function(data) {
|
p.stderr.on('data', function(data) {
|
||||||
common.fail(`Unexpected stderr data: ${data}`);
|
assert.fail(`Unexpected stderr data: ${data}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
let output = '';
|
let output = '';
|
||||||
|
@ -13,7 +13,7 @@ const p = child_process.spawn(process.execPath, [
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
p.stdout.on('data', function(data) {
|
p.stdout.on('data', function(data) {
|
||||||
common.fail('Unexpected stdout data: ' + data);
|
assert.fail('Unexpected stdout data: ' + data);
|
||||||
});
|
});
|
||||||
|
|
||||||
let output = '';
|
let output = '';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user