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 900a412

Browse filesBrowse files
TrottBethGriggs
authored andcommitted
test: increase error information in test-cli-syntax-*
If there is an error, but not the error code the test expects, display more information about the error. PR-URL: #25021 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
1 parent f43f45a commit 900a412
Copy full SHA for 900a412

File tree

Expand file treeCollapse file tree

3 files changed

+6
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+6
-3
lines changed
Open diff view settings
Collapse file

‎test/sequential/test-cli-syntax-bad.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-cli-syntax-bad.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ const syntaxErrorRE = /^SyntaxError: \b/m;
3232
const cmd = [node, ..._args].join(' ');
3333
exec(cmd, common.mustCall((err, stdout, stderr) => {
3434
assert.strictEqual(err instanceof Error, true);
35-
assert.strictEqual(err.code, 1);
35+
assert.strictEqual(err.code, 1,
36+
`code ${err.code} !== 1 for error:\n\n${err}`);
3637

3738
// no stdout should be produced
3839
assert.strictEqual(stdout, '');
Collapse file

‎test/sequential/test-cli-syntax-file-not-found.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-cli-syntax-file-not-found.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ const notFoundRE = /^Error: Cannot find module/m;
3333
// stderr should have a module not found error message
3434
assert(notFoundRE.test(stderr), `${notFoundRE} === ${stderr}`);
3535

36-
assert.strictEqual(err.code, 1);
36+
assert.strictEqual(err.code, 1,
37+
`code ${err.code} !== 1 for error:\n\n${err}`);
3738
}));
3839
});
3940
});
Collapse file

‎test/sequential/test-cli-syntax-require.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-cli-syntax-require.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const syntaxErrorRE = /^SyntaxError: \b/m;
2020
const cmd = [node, ...args].join(' ');
2121
exec(cmd, common.mustCall((err, stdout, stderr) => {
2222
assert.strictEqual(err instanceof Error, true);
23-
assert.strictEqual(err.code, 1);
23+
assert.strictEqual(err.code, 1,
24+
`code ${err.code} !== 1 for error:\n\n${err}`);
2425

2526
// no stdout should be produced
2627
assert.strictEqual(stdout, '');

0 commit comments

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