GeezerVison is showing github.com — test: make test-process-env-symbols agnostic · nodejs/node@e2f5648
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: test/parallel/test-process-env-symbols.js +6-3Lines changed: 6 additions & 3 deletions | 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 = /^TypeError: Cannot convert a Symbol value to a string$/; |
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); |
|