File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -3,20 +3,23 @@ require('../common');
3
3
4
4
const assert = require ( 'assert' ) ;
5
5
const symbol = Symbol ( 'sym' ) ;
6
- const errRegExp = / ^ T y p e E r r o r : C a n n o t c o n v e r t a S y m b o l v a l u e t o a s t r i n g $ / ;
7
6
8
7
// Verify that getting via a symbol key returns undefined.
9
8
assert . strictEqual ( process . env [ symbol ] , undefined ) ;
10
9
11
10
// 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.
12
13
assert . throws ( ( ) => {
13
14
process . env [ symbol ] = 42 ;
14
- } , errRegExp ) ;
15
+ } , TypeError ) ;
15
16
16
17
// 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.
17
20
assert . throws ( ( ) => {
18
21
process . env . foo = symbol ;
19
- } , errRegExp ) ;
22
+ } , TypeError ) ;
20
23
21
24
// Verify that using a symbol with the in operator returns false.
22
25
assert . strictEqual ( symbol in process . env , false ) ;
You can’t perform that action at this time.
0 commit comments