summaryrefslogtreecommitdiff
path: root/test/parallel/test-console.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2017-09-13 14:32:50 -0300
committerJames M Snell <jasnell@gmail.com>2017-09-20 14:25:41 -0700
commit757c34276b0571f6637380150a6b442aba2aef1a (patch)
treed86c9856826af41c34b163c4323349e1186d3090 /test/parallel/test-console.js
parent539445890b2df72d5fe6025b372e45f0f8a63075 (diff)
downloadnode-new-757c34276b0571f6637380150a6b442aba2aef1a.tar.gz
test: fix actual and expected order
In addition use the newer common.expectsError version. PR-URL: https://github.com/nodejs/node/pull/14881 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'test/parallel/test-console.js')
-rw-r--r--test/parallel/test-console.js30
1 files changed, 15 insertions, 15 deletions
diff --git a/test/parallel/test-console.js b/test/parallel/test-console.js
index bca70467c0..f63c4f9431 100644
--- a/test/parallel/test-console.js
+++ b/test/parallel/test-console.js
@@ -26,8 +26,8 @@ const assert = require('assert');
assert.ok(process.stdout.writable);
assert.ok(process.stderr.writable);
// Support legacy API
-assert.strictEqual('number', typeof process.stdout.fd);
-assert.strictEqual('number', typeof process.stderr.fd);
+assert.strictEqual(typeof process.stdout.fd, 'number');
+assert.strictEqual(typeof process.stderr.fd, 'number');
assert.doesNotThrow(function() {
process.once('warning', common.mustCall((warning) => {
@@ -123,19 +123,19 @@ const expectedStrings = [
];
for (const expected of expectedStrings) {
- assert.strictEqual(`${expected}\n`, strings.shift());
- assert.strictEqual(`${expected}\n`, errStrings.shift());
+ assert.strictEqual(strings.shift(), `${expected}\n`);
+ assert.strictEqual(errStrings.shift(), `${expected}\n`);
}
for (const expected of expectedStrings) {
- assert.strictEqual(`${expected}\n`, strings.shift());
- assert.strictEqual(`${expected}\n`, errStrings.shift());
+ assert.strictEqual(strings.shift(), `${expected}\n`);
+ assert.strictEqual(errStrings.shift(), `${expected}\n`);
}
-assert.strictEqual("{ foo: 'bar', inspect: [Function: inspect] }\n",
- strings.shift());
-assert.strictEqual("{ foo: 'bar', inspect: [Function: inspect] }\n",
- strings.shift());
+assert.strictEqual(strings.shift(),
+ "{ foo: 'bar', inspect: [Function: inspect] }\n");
+assert.strictEqual(strings.shift(),
+ "{ foo: 'bar', inspect: [Function: inspect] }\n");
assert.ok(strings.shift().includes('foo: [Object]'));
assert.strictEqual(strings.shift().includes('baz'), false);
assert.ok(/^label: \d+\.\d{3}ms$/.test(strings.shift().trim()));
@@ -143,15 +143,15 @@ assert.ok(/^__proto__: \d+\.\d{3}ms$/.test(strings.shift().trim()));
assert.ok(/^constructor: \d+\.\d{3}ms$/.test(strings.shift().trim()));
assert.ok(/^hasOwnProperty: \d+\.\d{3}ms$/.test(strings.shift().trim()));
-assert.strictEqual('Trace: This is a {"formatted":"trace"} 10 foo',
- errStrings.shift().split('\n').shift());
+assert.strictEqual(errStrings.shift().split('\n').shift(),
+ 'Trace: This is a {"formatted":"trace"} 10 foo');
-assert.throws(() => {
+common.expectsError(() => {
console.assert(false, 'should throw');
-}, common.expectsError({
+}, {
code: 'ERR_ASSERTION',
message: /^should throw$/
-}));
+});
assert.doesNotThrow(() => {
console.assert(true, 'this should not throw');