GeezerVison is showing github.com — test: remove unnecessary noop function args to `mustNotCall()` · nodejs/node@24a8fa9
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: test/.eslintrc.yaml +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 47 | 47 | message: Use Number.isNaN() instead of the global isNaN() function. | 48 | 48 | - selector: VariableDeclarator > CallExpression:matches([callee.name='debuglog'], [callee.property.name='debuglog']):not([arguments.0.value='test']) | 49 | 49 | 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] | 51 | 51 | message: Do not use an empty function, omit the parameter altogether. | 52 | 52 | - selector: Identifier[name='webcrypto'] | 53 | 53 | message: Use `globalThis.crypto`. | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-child-process-execfile.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -84,7 +84,7 @@ const execOpts = { encoding: 'utf8', shell: true }; | 84 | 84 | // Verify that if something different than Abortcontroller.signal | 85 | 85 | // is passed, ERR_INVALID_ARG_TYPE is thrown | 86 | 86 | assert.throws(() => { | 87 | | - const callback = common.mustNotCall(() => {}); | | 87 | + const callback = common.mustNotCall(); | 88 | 88 |
| 89 | 89 | execFile(process.execPath, [echoFixture, 0], { signal: 'hello' }, callback); | 90 | 90 | }, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' }); | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-fs-promises-readfile.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -64,7 +64,7 @@ async function validateWrongSignalParam() { | 64 | 64 | // is passed, ERR_INVALID_ARG_TYPE is thrown | 65 | 65 |
| 66 | 66 | await assert.rejects(async () => { | 67 | | - const callback = common.mustNotCall(() => {}); | | 67 | + const callback = common.mustNotCall(); | 68 | 68 | await readFile(fn, { signal: 'hello' }, callback); | 69 | 69 | }, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' }); | 70 | 70 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-fs-readfile.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -95,7 +95,7 @@ for (const e of fileInfo) { | 95 | 95 | // Verify that if something different than Abortcontroller.signal | 96 | 96 | // is passed, ERR_INVALID_ARG_TYPE is thrown | 97 | 97 | assert.throws(() => { | 98 | | - const callback = common.mustNotCall(() => {}); | | 98 | + const callback = common.mustNotCall(); | 99 | 99 | fs.readFile(fileInfo[0].name, { signal: 'hello' }, callback); | 100 | 100 | }, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' }); | 101 | 101 | } |
Collapse file 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 number | Diff line number | Diff line change |
|---|
@@ -11,7 +11,7 @@ const http2 = require('http2'); | 11 | 11 | const { NghttpError } = require('internal/http2/util'); | 12 | 12 |
| 13 | 13 | // Creating an http1 server here... | 14 | | -const server = http.createServer(common.mustNotCall(() => {})) | | 14 | +const server = http.createServer(common.mustNotCall()) | 15 | 15 | .on('clientError', common.mustCall((error, socket) => { | 16 | 16 | assert.strictEqual(error.code, 'HPE_PAUSED_H2_UPGRADE'); | 17 | 17 | assert.strictEqual(error.bytesParsed, 24); | |
Collapse file 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 number | Diff line number | Diff line change |
|---|
@@ -32,7 +32,7 @@ const server = https.createServer(options, function(req, res) { | 32 | 32 | path: '/', | 33 | 33 | ca, | 34 | 34 | servername: 'nodejs.org', | 35 | | - }, common.mustNotCall(() => {})); | | 35 | + }, common.mustNotCall()); | 36 | 36 |
| 37 | 37 | req.on('error', common.mustCall((err) => { | 38 | 38 | assert.strictEqual( | @@ -45,7 +45,7 @@ const server = https.createServer(options, function(req, res) { | 45 | 45 | path: '/', | 46 | 46 | ca, | 47 | 47 | servername: 'nodejs.org', | 48 | | - }, common.mustNotCall(() => {})); | | 48 | + }, common.mustNotCall()); | 49 | 49 |
| 50 | 50 | second.on('error', common.mustCall((err) => { | 51 | 51 | server.close(); | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-readline-interface.js +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1067,8 +1067,7 @@ for (let i = 0; i < 12; i++) { | 1067 | 1067 | rli.question('foo?', common.mustCall((answer) => { | 1068 | 1068 | assert.strictEqual(answer, 'baz'); | 1069 | 1069 | })); | 1070 | | - rli.question('bar?', common.mustNotCall(() => { | 1071 | | - })); | | 1070 | + rli.question('bar?', common.mustNotCall()); | 1072 | 1071 | rli.write('baz\n'); | 1073 | 1072 | rli.close(); | 1074 | 1073 | } | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-stream-filter.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -169,7 +169,7 @@ const { setTimeout } = require('timers/promises'); | 169 | 169 | { | 170 | 170 | const stream = Readable.from([1, 2, 3, 4, 5]); | 171 | 171 | Object.defineProperty(stream, 'map', { | 172 | | - value: common.mustNotCall(() => {}), | | 172 | + value: common.mustNotCall(), | 173 | 173 | }); | 174 | 174 | // Check that map isn't getting called. | 175 | 175 | stream.filter(() => true); | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-stream-flatMap.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -124,7 +124,7 @@ function oneTo5() { | 124 | 124 | { | 125 | 125 | const stream = oneTo5(); | 126 | 126 | Object.defineProperty(stream, 'map', { | 127 | | - value: common.mustNotCall(() => {}), | | 127 | + value: common.mustNotCall(), | 128 | 128 | }); | 129 | 129 | // Check that map isn't getting called. | 130 | 130 | stream.flatMap(() => true); | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-stream-forEach.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -132,7 +132,7 @@ const { once } = require('events'); | 132 | 132 | { | 133 | 133 | const stream = Readable.from([1, 2, 3, 4, 5]); | 134 | 134 | Object.defineProperty(stream, 'map', { | 135 | | - value: common.mustNotCall(() => {}), | | 135 | + value: common.mustNotCall(), | 136 | 136 | }); | 137 | 137 | // Check that map isn't getting called. | 138 | 138 | stream.forEach(() => true); | |
|