Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f0480d6

Browse filesBrowse files
aduh95RafaelGSS
authored andcommitted
test: remove unnecessary noop function args to mustCall()
RefsL #45027 PR-URL: #45047 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
1 parent 82e6043 commit f0480d6
Copy full SHA for f0480d6
Expand file treeCollapse file tree

24 files changed

+32
-38
lines changed
Open diff view settings
Collapse file

‎test/.eslintrc.yaml‎

Copy file name to clipboardExpand all lines: test/.eslintrc.yaml
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ rules:
4646
message: Use Number.isNaN() instead of the global isNaN() function.
4747
- selector: VariableDeclarator > CallExpression:matches([callee.name='debuglog'], [callee.property.name='debuglog']):not([arguments.0.value='test'])
4848
message: Use 'test' as debuglog value in tests.
49+
- selector: CallExpression:matches([callee.object.name="common"][callee.property.name=/^mustCall/],[callee.name="mustCall"],[callee.name="mustCallAtLeast"])>:first-child[type=/FunctionExpression$/][body.body.length=0]
50+
message: Do not use an empty function, omit the parameter altogether.
4951

5052
# Custom rules in tools/eslint-rules
5153
node-core/prefer-assert-iferror: error
Collapse file

‎test/async-hooks/test-http-agent-handle-reuse-parallel.js‎

Copy file name to clipboardExpand all lines: test/async-hooks/test-http-agent-handle-reuse-parallel.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const verifyRequest = (idx) => (res) => {
3434
socket = res.socket;
3535
}
3636

37-
res.on('data', common.mustCallAtLeast(() => {}));
37+
res.on('data', common.mustCallAtLeast());
3838
res.on('end', common.mustCall(() => {
3939
if (++responses === 2) {
4040
// Clean up to let the event loop stop.
Collapse file

‎test/async-hooks/test-http-agent-handle-reuse-serial.js‎

Copy file name to clipboardExpand all lines: test/async-hooks/test-http-agent-handle-reuse-serial.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const server = http.createServer(common.mustCall((req, res) => {
4747
// Check that request and response share their socket.
4848
assert.strictEqual(r1.socket, socket);
4949

50-
res.on('data', common.mustCallAtLeast(() => {}));
50+
res.on('data', common.mustCallAtLeast());
5151
res.on('end', common.mustCall(() => {
5252
// setImmediate() to give the agent time to register the freed socket.
5353
setImmediate(common.mustCall(() => {
@@ -70,7 +70,7 @@ const server = http.createServer(common.mustCall((req, res) => {
7070
// Empty payload, to hit the “right” code path.
7171
r2.end('');
7272

73-
res.on('data', common.mustCallAtLeast(() => {}));
73+
res.on('data', common.mustCallAtLeast());
7474
res.on('end', common.mustCall(() => {
7575
// Clean up to let the event loop stop.
7676
server.close();
Collapse file

‎test/known_issues/test-http-path-contains-unicode.js‎

Copy file name to clipboardExpand all lines: test/known_issues/test-http-path-contains-unicode.js
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ assert.strictEqual(expected, '/caf\u{e9}\u{1f436}');
1414

1515
const server = http.createServer(common.mustCall(function(req, res) {
1616
assert.strictEqual(req.url, expected);
17-
req.on('data', common.mustCall(function() {
18-
})).on('end', common.mustCall(function() {
17+
req.on('data', common.mustCall()).on('end', common.mustCall(function() {
1918
server.close();
2019
res.writeHead(200);
2120
res.end('hello world\n');
Collapse file

‎test/parallel/test-async-hooks-http-agent-destroy.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-async-hooks-http-agent-destroy.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const server = http.createServer(common.mustCall((req, res) => {
5050
// Check that request and response share their socket.
5151
assert.strictEqual(r1.socket, socket);
5252

53-
res.on('data', common.mustCallAtLeast(() => {}));
53+
res.on('data', common.mustCallAtLeast());
5454
res.on('end', common.mustCall(() => {
5555
// setImmediate() to give the agent time to register the freed socket.
5656
setImmediate(common.mustCall(() => {
@@ -66,7 +66,7 @@ const server = http.createServer(common.mustCall((req, res) => {
6666
// Empty payload, to hit the “right” code path.
6767
r2.end('');
6868

69-
res.on('data', common.mustCallAtLeast(() => {}));
69+
res.on('data', common.mustCallAtLeast());
7070
res.on('end', common.mustCall(() => {
7171
// Clean up to let the event loop stop.
7272
server.close();
Collapse file

‎test/parallel/test-async-hooks-http-agent.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-async-hooks-http-agent.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const server = http.createServer(common.mustCall((req, res) => {
4040
// Check that request and response share their socket.
4141
assert.strictEqual(r1.socket, socket);
4242

43-
res.on('data', common.mustCallAtLeast(() => {}));
43+
res.on('data', common.mustCallAtLeast());
4444
res.on('end', common.mustCall(() => {
4545
// setImmediate() to give the agent time to register the freed socket.
4646
setImmediate(common.mustCall(() => {
@@ -62,7 +62,7 @@ const server = http.createServer(common.mustCall((req, res) => {
6262
// Empty payload, to hit the “right” code path.
6363
r2.end('');
6464

65-
res.on('data', common.mustCallAtLeast(() => {}));
65+
res.on('data', common.mustCallAtLeast());
6666
res.on('end', common.mustCall(() => {
6767
// Clean up to let the event loop stop.
6868
server.close();
Collapse file

‎test/parallel/test-cluster-fork-windowsHide.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-cluster-fork-windowsHide.js
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ if (!process.argv[2]) {
2020
{ detached: true, stdio: ['ignore', 'ignore', 'ignore', 'ipc'] });
2121

2222
const messageHandlers = {
23-
workerOnline: common.mustCall((msg) => {
24-
}),
23+
workerOnline: common.mustCall(),
2524
mainWindowHandle: common.mustCall((msg) => {
2625
assert.match(msg.value, /0\s*/);
2726
}),
Collapse file

‎test/parallel/test-cluster-ipc-throw.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-cluster-ipc-throw.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (cluster.isPrimary) {
1717
}));
1818
} else {
1919
assert(process.env.PORT);
20-
process.on('uncaughtException', common.mustCall((e) => {}));
20+
process.on('uncaughtException', common.mustCall());
2121
server.listen(process.env.PORT);
2222
server.on('error', common.mustCall((e) => {
2323
cluster.worker.disconnect();
Collapse file

‎test/parallel/test-cluster-worker-kill-signal.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-cluster-worker-kill-signal.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if (cluster.isWorker) {
1313
const http = require('http');
1414
const server = http.Server(() => { });
1515

16-
server.once('listening', common.mustCall(() => { }));
16+
server.once('listening', common.mustCall());
1717
server.listen(0, '127.0.0.1');
1818

1919
} else if (cluster.isMaster) {
Collapse file

‎test/parallel/test-cluster-worker-kill.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-cluster-worker-kill.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if (cluster.isWorker) {
3535
const http = require('http');
3636
const server = http.Server(() => { });
3737

38-
server.once('listening', common.mustCall(() => { }));
38+
server.once('listening', common.mustCall());
3939
server.listen(0, '127.0.0.1');
4040

4141
} else if (cluster.isPrimary) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.