Files
node/test/parallel/test-vm-create-context-arg.js
akira.xue 94ff5918b6 test: use regluar expression in vm test
update test/parallel/test-vm-create-context-arg.js
in line 27 to change `TypeError` to the regular expression
with the `/^TypeError: sandbox must be an object$/`.

PR-URL: https://github.com/nodejs/node/pull/14266
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-09-05 12:49:55 -04:00

20 lines
437 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
const vm = require('vm');
assert.throws(function() {
vm.createContext('string is not supported');
}, /^TypeError: sandbox must be an object$/);
assert.doesNotThrow(function() {
vm.createContext({ a: 1 });
vm.createContext([0, 1, 2, 3]);
});
assert.doesNotThrow(function() {
const sandbox = {};
vm.createContext(sandbox);
vm.createContext(sandbox);
});