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 e2f5648

Browse filesBrowse files
Trottevanlucas
authored andcommitted
test: make test-process-env-symbols agnostic
Do not check the error message if it is generated by the JavaScript engine (V8, ChakraCore, etc.). Do confirm that it is a `TypeError`. PR-URL: #16272 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent 9bf8874 commit e2f5648
Copy full SHA for e2f5648

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎test/parallel/test-process-env-symbols.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-process-env-symbols.js
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,23 @@ require('../common');
33

44
const assert = require('assert');
55
const symbol = Symbol('sym');
6-
const errRegExp = /^TypeError: Cannot convert a Symbol value to a string$/;
76

87
// Verify that getting via a symbol key returns undefined.
98
assert.strictEqual(process.env[symbol], undefined);
109

1110
// Verify that assigning via a symbol key throws.
11+
// The message depends on the JavaScript engine and so will be different between
12+
// different JavaScript engines. Confirm that the `Error` is a `TypeError` only.
1213
assert.throws(() => {
1314
process.env[symbol] = 42;
14-
}, errRegExp);
15+
}, TypeError);
1516

1617
// Verify that assigning a symbol value throws.
18+
// The message depends on the JavaScript engine and so will be different between
19+
// different JavaScript engines. Confirm that the `Error` is a `TypeError` only.
1720
assert.throws(() => {
1821
process.env.foo = symbol;
19-
}, errRegExp);
22+
}, TypeError);
2023

2124
// Verify that using a symbol with the in operator returns false.
2225
assert.strictEqual(symbol in process.env, false);

0 commit comments

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