diff --git a/test/parallel/test-process-env-symbols.js b/test/parallel/test-process-env-symbols.js index 13a9cd4df30ae6..51e8eafbeacf51 100644 --- a/test/parallel/test-process-env-symbols.js +++ b/test/parallel/test-process-env-symbols.js @@ -3,20 +3,23 @@ require('../common'); const assert = require('assert'); const symbol = Symbol('sym'); -const errRegExp = /^TypeError: Cannot convert a Symbol value to a string$/; // Verify that getting via a symbol key returns undefined. assert.strictEqual(process.env[symbol], undefined); // Verify that assigning via a symbol key throws. +// The message depends on the JavaScript engine and so will be different between +// different JavaScript engines. Confirm that the `Error` is a `TypeError` only. assert.throws(() => { process.env[symbol] = 42; -}, errRegExp); +}, TypeError); // Verify that assigning a symbol value throws. +// The message depends on the JavaScript engine and so will be different between +// different JavaScript engines. Confirm that the `Error` is a `TypeError` only. assert.throws(() => { process.env.foo = symbol; -}, errRegExp); +}, TypeError); // Verify that using a symbol with the in operator returns false. assert.strictEqual(symbol in process.env, false);