Skip to content

Commit a7a1cb4

Browse files
committed
test: check for the correct strict equal arguments order
This activates a eslint rule to verify that the `assert.strictEqual()` arguments are in the correct order. PR-URL: #24752 Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 1ec4f8d commit a7a1cb4

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

test/.eslintrc.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ rules:
4848
message: "The first argument should be the `actual`, not the `expected` value."
4949
- selector: "CallExpression[callee.object.name='assert'][callee.property.name='deepStrictEqual'][arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression'])"
5050
message: "The first argument should be the `actual`, not the `expected` value."
51-
# TODO: Activate the `strictEqual` rule as soon as it produces less churn.
52-
# - selector: "CallExpression[callee.object.name='assert'][callee.property.name='strictEqual'][arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression'])"
53-
# message: "The first argument should be the `actual`, not the `expected` value."
51+
- selector: "CallExpression[callee.object.name='assert'][callee.property.name='strictEqual'][arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression'])"
52+
message: "The first argument should be the `actual`, not the `expected` value."
5453
# Global scoped methods and vars
5554
globals:
5655
WebAssembly: false

test/parallel/test-http-blank-header.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ const net = require('net');
2828
const server = http.createServer(common.mustCall((req, res) => {
2929
assert.strictEqual(req.method, 'GET');
3030
assert.strictEqual(req.url, '/blah');
31-
assert.deepStrictEqual({
31+
assert.deepStrictEqual(req.headers, {
3232
host: 'example.org:443',
3333
origin: 'http://example.org',
3434
cookie: ''
35-
}, req.headers);
35+
});
3636
}));
3737

3838

@@ -52,7 +52,7 @@ server.listen(0, common.mustCall(() => {
5252
received += data.toString();
5353
}));
5454
c.on('end', common.mustCall(() => {
55-
assert.strictEqual('HTTP/1.1 400 Bad Request\r\n\r\n', received);
55+
assert.strictEqual(received, 'HTTP/1.1 400 Bad Request\r\n\r\n');
5656
c.end();
5757
}));
5858
c.on('close', common.mustCall(() => server.close()));

test/parallel/test-process-env.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ if (process.argv[2] === 'you-are-the-child') {
6868
// delete should return true except for non-configurable properties
6969
// https://github.com/nodejs/node/issues/7960
7070
delete process.env.NON_EXISTING_VARIABLE;
71-
assert.strictEqual(true, delete process.env.NON_EXISTING_VARIABLE);
71+
assert(delete process.env.NON_EXISTING_VARIABLE);
7272

7373
/* For the moment we are not going to support setting the timezone via the
7474
* environment variables. The problem is that various V8 platform backends

0 commit comments

Comments
 (0)