Skip to content

Commit 6f85c81

Browse files
gibfahnMylesBorins
authored andcommitted
test: s/assert.equal/assert.strictEqual/
Use assert.strictEqual instead of assert.equal in tests, manually convert types where necessary. Backport-PR-URL: #11795 PR-URL: #10698 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Teddy Katz <[email protected]>
1 parent afea1d0 commit 6f85c81

File tree

365 files changed

+2205
-2147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

365 files changed

+2205
-2147
lines changed

test/addons/load-long-path/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ fs.writeFileSync(addonDestinationPath, contents);
3333

3434
// Attempt to load at long path destination
3535
const addon = require(addonDestinationPath);
36-
assert.notEqual(addon, null);
36+
assert.notStrictEqual(addon, null);
3737
assert.strictEqual(addon.hello(), 'world');

test/disabled/test-fs-largefile.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ var path = require('path'),
99
message = 'Large File';
1010

1111
fs.truncateSync(fd, offset);
12-
assert.equal(fs.statSync(filepath).size, offset);
12+
assert.strictEqual(fs.statSync(filepath).size, offset);
1313
var writeBuf = Buffer.from(message);
1414
fs.writeSync(fd, writeBuf, 0, writeBuf.length, offset);
1515
var readBuf = Buffer.allocUnsafe(writeBuf.length);
1616
fs.readSync(fd, readBuf, 0, readBuf.length, offset);
17-
assert.equal(readBuf.toString(), message);
17+
assert.strictEqual(readBuf.toString(), message);
1818
fs.readSync(fd, readBuf, 0, 1, 0);
19-
assert.equal(readBuf[0], 0);
19+
assert.strictEqual(readBuf[0], 0);
2020

2121
var exceptionRaised = false;
2222
try {
2323
fs.writeSync(fd, writeBuf, 0, writeBuf.length, 42.000001);
2424
} catch (err) {
2525
console.log(err);
2626
exceptionRaised = true;
27-
assert.equal(err.message, 'Not an integer');
27+
assert.strictEqual(err.message, 'Not an integer');
2828
}
2929
assert.ok(exceptionRaised);
3030
fs.close(fd);

test/disabled/test-http-abort-stream-end.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ s.listen(common.PORT, function() {
3636

3737
process.on('exit', function() {
3838
assert(aborted);
39-
assert.equal(size, maxSize);
39+
assert.strictEqual(size, maxSize);
4040
console.log('ok');
4141
});

test/disabled/test-readline.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ var rl = readlineFakeStream();
4949
var written_bytes_length, refreshed;
5050

5151
rl.write('foo');
52-
assert.equal(3, rl.cursor);
52+
assert.strictEqual(3, rl.cursor);
5353
[key.xterm, key.rxvt, key.gnome, key.putty].forEach(function(key) {
5454
rl.write.apply(rl, key.home);
55-
assert.equal(0, rl.cursor);
55+
assert.strictEqual(0, rl.cursor);
5656
rl.write.apply(rl, key.end);
57-
assert.equal(3, rl.cursor);
57+
assert.strictEqual(3, rl.cursor);
5858
});
5959

6060
rl = readlineFakeStream();
@@ -76,9 +76,9 @@ rl.write.apply(rl, key.xterm.home);
7676
].forEach(function(action) {
7777
written_bytes_length = rl.written_bytes.length;
7878
rl.write.apply(rl, action.key);
79-
assert.equal(action.cursor, rl.cursor);
79+
assert.strictEqual(action.cursor, rl.cursor);
8080
refreshed = written_bytes_length !== rl.written_bytes.length;
81-
assert.equal(true, refreshed);
81+
assert.strictEqual(true, refreshed);
8282
});
8383

8484
rl = readlineFakeStream();
@@ -93,7 +93,7 @@ rl.write.apply(rl, key.xterm.home);
9393
''
9494
].forEach(function(expectedLine) {
9595
rl.write.apply(rl, key.xterm.metad);
96-
assert.equal(0, rl.cursor);
97-
assert.equal(expectedLine, rl.line);
96+
assert.strictEqual(0, rl.cursor);
97+
assert.strictEqual(expectedLine, rl.line);
9898
});
9999
rl.close();

test/disabled/test-sendfd.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ var logChild = function(d) {
6363
// validate any data sent back by the child. We send the write end of the
6464
// pipe to the child and close it off in our process.
6565
var pipeFDs = netBinding.pipe();
66-
assert.equal(pipeFDs.length, 2);
66+
assert.strictEqual(pipeFDs.length, 2);
6767

6868
var seenOrdinals = [];
6969

@@ -72,8 +72,8 @@ pipeReadStream.on('data', function(data) {
7272
data.toString('utf8').trim().split('\n').forEach(function(d) {
7373
var rd = JSON.parse(d);
7474

75-
assert.equal(rd.pid, cpp);
76-
assert.equal(seenOrdinals.indexOf(rd.ord), -1);
75+
assert.strictEqual(rd.pid, cpp);
76+
assert.strictEqual(seenOrdinals.indexOf(rd.ord), -1);
7777

7878
seenOrdinals.unshift(rd.ord);
7979
});
@@ -119,8 +119,8 @@ cp.on('exit', function(code, signal) {
119119
srv.close();
120120
// fs.unlinkSync(SOCK_PATH);
121121

122-
assert.equal(code, 0);
123-
assert.equal(seenOrdinals.length, 2);
122+
assert.strictEqual(code, 0);
123+
assert.strictEqual(seenOrdinals.length, 2);
124124
});
125125

126126
// vim:ts=2 sw=2 et

test/disabled/test-setuidgid.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ assert.notEqual(newuid, olduid, 'uids expected to be different');
1616
try {
1717
process.setuid('nobody1234');
1818
} catch (e) {
19-
assert.equal(e.message,
19+
assert.strictEqual(e.message,
2020
'failed to resolve group',
2121
'unexpected error message'
2222
);

test/fixtures/GH-892-request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var options = {
1616
};
1717

1818
var req = https.request(options, function(res) {
19-
assert.equal(200, res.statusCode);
19+
assert.strictEqual(200, res.statusCode);
2020
gotResponse = true;
2121
console.error('DONE');
2222
res.resume();

test/fixtures/b/c.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var assert = require('assert');
44

55
var package = require('./package');
66

7-
assert.equal('world', package.hello);
7+
assert.strictEqual('world', package.hello);
88

99
console.error('load fixtures/b/c.js');
1010

test/fixtures/node_modules/baz/index.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/node_modules/foo.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)