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 a0f89a2

Browse filesBrowse files
juansb827targos
authored andcommitted
test: refactor test using assert instead of try/catch
PR-URL: #28346 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
1 parent 32cf344 commit a0f89a2
Copy full SHA for a0f89a2

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+13
-13
lines changed
Open diff view settings
Collapse file

‎test/pseudo-tty/test-assert-no-color.js‎

Copy file name to clipboardExpand all lines: test/pseudo-tty/test-assert-no-color.js
+13-13Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ const assert = require('assert').strict;
44

55
process.env.NODE_DISABLE_COLORS = true;
66

7-
try {
8-
assert.deepStrictEqual({}, { foo: 'bar' });
9-
} catch (error) {
10-
const expected =
11-
'Expected values to be strictly deep-equal:\n' +
12-
'+ actual - expected\n' +
13-
'\n' +
14-
'+ {}\n' +
15-
'- {\n' +
16-
'- foo: \'bar\'\n' +
17-
'- }';
18-
assert.strictEqual(error.message, expected);
19-
}
7+
assert.throws(
8+
() => {
9+
assert.deepStrictEqual({}, { foo: 'bar' });
10+
},
11+
{
12+
message: 'Expected values to be strictly deep-equal:\n' +
13+
'+ actual - expected\n' +
14+
'\n' +
15+
'+ {}\n' +
16+
'- {\n' +
17+
'- foo: \'bar\'\n' +
18+
'- }'
19+
});

0 commit comments

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