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 24a8fa9

Browse filesBrowse files
aduh95RafaelGSS
authored andcommitted
test: remove unnecessary noop function args to mustNotCall()
PR-URL: #48513 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Harshitha K P <harshitha014@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 84d0eb7 commit 24a8fa9
Copy full SHA for 24a8fa9
Expand file treeCollapse file tree

14 files changed

+17
-18
lines changed
Open diff view settings
Collapse file

‎test/.eslintrc.yaml‎

Copy file name to clipboardExpand all lines: test/.eslintrc.yaml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ rules:
4747
message: Use Number.isNaN() instead of the global isNaN() function.
4848
- selector: VariableDeclarator > CallExpression:matches([callee.name='debuglog'], [callee.property.name='debuglog']):not([arguments.0.value='test'])
4949
message: Use 'test' as debuglog value in tests.
50-
- 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+
- selector: CallExpression:matches([callee.object.name="common"][callee.property.name=/^must(Not)?Call/],[callee.name="mustCall"],[callee.name="mustCallAtLeast"],[callee.name="mustNotCall"])>:first-child[type=/FunctionExpression$/][body.body.length=0]
5151
message: Do not use an empty function, omit the parameter altogether.
5252
- selector: Identifier[name='webcrypto']
5353
message: Use `globalThis.crypto`.
Collapse file

‎test/parallel/test-child-process-execfile.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-execfile.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const execOpts = { encoding: 'utf8', shell: true };
8484
// Verify that if something different than Abortcontroller.signal
8585
// is passed, ERR_INVALID_ARG_TYPE is thrown
8686
assert.throws(() => {
87-
const callback = common.mustNotCall(() => {});
87+
const callback = common.mustNotCall();
8888

8989
execFile(process.execPath, [echoFixture, 0], { signal: 'hello' }, callback);
9090
}, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' });
Collapse file

‎test/parallel/test-fs-promises-readfile.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-promises-readfile.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ async function validateWrongSignalParam() {
6464
// is passed, ERR_INVALID_ARG_TYPE is thrown
6565

6666
await assert.rejects(async () => {
67-
const callback = common.mustNotCall(() => {});
67+
const callback = common.mustNotCall();
6868
await readFile(fn, { signal: 'hello' }, callback);
6969
}, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' });
7070

Collapse file

‎test/parallel/test-fs-readfile.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-readfile.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ for (const e of fileInfo) {
9595
// Verify that if something different than Abortcontroller.signal
9696
// is passed, ERR_INVALID_ARG_TYPE is thrown
9797
assert.throws(() => {
98-
const callback = common.mustNotCall(() => {});
98+
const callback = common.mustNotCall();
9999
fs.readFile(fileInfo[0].name, { signal: 'hello' }, callback);
100100
}, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' });
101101
}
Collapse file

‎test/parallel/test-http2-client-http1-server.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http2-client-http1-server.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const http2 = require('http2');
1111
const { NghttpError } = require('internal/http2/util');
1212

1313
// Creating an http1 server here...
14-
const server = http.createServer(common.mustNotCall(() => {}))
14+
const server = http.createServer(common.mustNotCall())
1515
.on('clientError', common.mustCall((error, socket) => {
1616
assert.strictEqual(error.code, 'HPE_PAUSED_H2_UPGRADE');
1717
assert.strictEqual(error.bytesParsed, 24);
Collapse file

‎test/parallel/test-https-agent-session-injection.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-https-agent-session-injection.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const server = https.createServer(options, function(req, res) {
3232
path: '/',
3333
ca,
3434
servername: 'nodejs.org',
35-
}, common.mustNotCall(() => {}));
35+
}, common.mustNotCall());
3636

3737
req.on('error', common.mustCall((err) => {
3838
assert.strictEqual(
@@ -45,7 +45,7 @@ const server = https.createServer(options, function(req, res) {
4545
path: '/',
4646
ca,
4747
servername: 'nodejs.org',
48-
}, common.mustNotCall(() => {}));
48+
}, common.mustNotCall());
4949

5050
second.on('error', common.mustCall((err) => {
5151
server.close();
Collapse file

‎test/parallel/test-readline-interface.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-readline-interface.js
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,8 +1067,7 @@ for (let i = 0; i < 12; i++) {
10671067
rli.question('foo?', common.mustCall((answer) => {
10681068
assert.strictEqual(answer, 'baz');
10691069
}));
1070-
rli.question('bar?', common.mustNotCall(() => {
1071-
}));
1070+
rli.question('bar?', common.mustNotCall());
10721071
rli.write('baz\n');
10731072
rli.close();
10741073
}
Collapse file

‎test/parallel/test-stream-filter.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-stream-filter.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ const { setTimeout } = require('timers/promises');
169169
{
170170
const stream = Readable.from([1, 2, 3, 4, 5]);
171171
Object.defineProperty(stream, 'map', {
172-
value: common.mustNotCall(() => {}),
172+
value: common.mustNotCall(),
173173
});
174174
// Check that map isn't getting called.
175175
stream.filter(() => true);
Collapse file

‎test/parallel/test-stream-flatMap.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-stream-flatMap.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ function oneTo5() {
124124
{
125125
const stream = oneTo5();
126126
Object.defineProperty(stream, 'map', {
127-
value: common.mustNotCall(() => {}),
127+
value: common.mustNotCall(),
128128
});
129129
// Check that map isn't getting called.
130130
stream.flatMap(() => true);
Collapse file

‎test/parallel/test-stream-forEach.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-stream-forEach.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ const { once } = require('events');
132132
{
133133
const stream = Readable.from([1, 2, 3, 4, 5]);
134134
Object.defineProperty(stream, 'map', {
135-
value: common.mustNotCall(() => {}),
135+
value: common.mustNotCall(),
136136
});
137137
// Check that map isn't getting called.
138138
stream.forEach(() => true);

0 commit comments

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