Skip to content

Commit e2f5648

Browse 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 <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent 9bf8874 commit e2f5648

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

+6-3
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)