Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v8.x backport] tools, test: forbid string literal as third argument for assert.strictEqual() and friends #22888

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/parallel/test-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,11 +610,11 @@ try {
}

try {
assert.strictEqual(1, 2, 'oh no');
assert.strictEqual(1, 2, 'oh no'); // eslint-disable-line no-restricted-syntax
} catch (e) {
assert.strictEqual(e.message.split('\n')[0], 'oh no');
assert.strictEqual(e.generatedMessage, false,
'Message incorrectly marked as generated');
// Message should not be marked as generated.
assert.strictEqual(e.generatedMessage, false);
}

{
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-dns-resolveany-bad-ancount.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ server.bind(0, common.mustCall(() => {
assert.strictEqual(err.syscall, 'queryAny');
assert.strictEqual(err.hostname, 'example.org');
const descriptor = Object.getOwnPropertyDescriptor(err, 'message');
assert.strictEqual(descriptor.enumerable,
false, 'The error message should be non-enumerable');
// The error message should be non-enumerable.
assert.strictEqual(descriptor.enumerable, false);
server.close();
}));
}));
4 changes: 2 additions & 2 deletions test/parallel/test-next-tick-domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ const origNextTick = process.nextTick;

require('domain');

assert.strictEqual(origNextTick, process.nextTick,
'Requiring domain should not change nextTick');
// Requiring domain should not change nextTick.
assert.strictEqual(origNextTick, process.nextTick);
4 changes: 2 additions & 2 deletions test/parallel/test-vm-run-in-new-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const common = require('../common');
const assert = require('assert');
const vm = require('vm');

assert.strictEqual(typeof global.gc, 'function',
'Run this test with --expose-gc');
if (typeof global.gc !== 'function')
assert.fail('Run this test with --expose-gc');

common.globalCheck = false;

Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-http2-timeout-large-write-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ server.on('stream', common.mustCall((stream) => {
}));
server.setTimeout(serverTimeout);
server.on('timeout', () => {
assert.strictEqual(didReceiveData, false, 'Should not timeout');
assert.ok(!didReceiveData, 'Should not timeout');
});

server.listen(0, common.mustCall(() => {
Expand Down
4 changes: 2 additions & 2 deletions test/sequential/test-http2-timeout-large-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ server.on('stream', common.mustCall((stream) => {
stream.write(content);
stream.setTimeout(serverTimeout);
stream.on('timeout', () => {
assert.strictEqual(didReceiveData, false, 'Should not timeout');
assert.ok(!didReceiveData, 'Should not timeout');
});
stream.end();
}));
server.setTimeout(serverTimeout);
server.on('timeout', () => {
assert.strictEqual(didReceiveData, false, 'Should not timeout');
assert.ok(!didReceiveData, 'Should not timeout');
});

server.listen(0, common.mustCall(() => {
Expand Down
3 changes: 1 addition & 2 deletions test/sequential/test-inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ function checkBadPath(err) {
}

function checkException(message) {
assert.strictEqual(message.exceptionDetails, undefined,
'An exception occurred during execution');
assert.strictEqual(message.exceptionDetails, undefined);
}

function assertNoUrlsWhileConnected(response) {
Expand Down