summaryrefslogtreecommitdiff
path: root/test/parallel/test-vm-is-context.js
diff options
context:
space:
mode:
authordustinnewman98 <dustinnewman98@gmail.com>2018-03-01 22:11:55 -0800
committerMichaƫl Zasso <targos@protonmail.com>2018-03-22 15:54:52 +0100
commit49b2969ef4731ad4a3b63476d80ce31075526613 (patch)
tree98ebe9eb18fc2ca8ec0ac6cd5d4bc791bcae0a63 /test/parallel/test-vm-is-context.js
parent4e1f0907dae9916215985a9f81bf3dec1eeaeaef (diff)
downloadandroid-node-v8-49b2969ef4731ad4a3b63476d80ce31075526613.tar.gz
android-node-v8-49b2969ef4731ad4a3b63476d80ce31075526613.tar.bz2
android-node-v8-49b2969ef4731ad4a3b63476d80ce31075526613.zip
vm: migrate isContext to internal/errors
PR-URL: https://github.com/nodejs/node/pull/19268 Refs: https://github.com/nodejs/node/issues/18106 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'test/parallel/test-vm-is-context.js')
-rw-r--r--test/parallel/test-vm-is-context.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/test/parallel/test-vm-is-context.js b/test/parallel/test-vm-is-context.js
index 6c3b783c5e..a762622c67 100644
--- a/test/parallel/test-vm-is-context.js
+++ b/test/parallel/test-vm-is-context.js
@@ -20,13 +20,27 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
-require('../common');
+const common = require('../common');
const assert = require('assert');
const vm = require('vm');
-assert.throws(function() {
- vm.isContext('string is not supported');
-}, /^TypeError: sandbox must be an object$/);
+for (const valToTest of [
+ 'string', null, undefined, 8.9, Symbol('sym'), true
+]) {
+ common.expectsError(() => {
+ vm.isContext(valToTest);
+ }, {
+ code: 'ERR_INVALID_ARG_TYPE',
+ type: TypeError
+ });
+}
+
+common.expectsError(() => {
+ vm.isContext();
+}, {
+ code: 'ERR_MISSING_ARGS',
+ type: TypeError
+});
assert.strictEqual(vm.isContext({}), false);
assert.strictEqual(vm.isContext([]), false);