From a401f13bbe8a005c7f75cd300105d65a19fbc236 Mon Sep 17 00:00:00 2001 From: Dan Corman <dan.corman@gmail.com> Date: Tue, 6 Nov 2018 16:19:52 +0000 Subject: [PATCH 1/2] test: add typeerror for vm/compileFunction params --- test/parallel/test-vm-basic.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/parallel/test-vm-basic.js b/test/parallel/test-vm-basic.js index df0c7df1062c14..07344c6777ca49 100644 --- a/test/parallel/test-vm-basic.js +++ b/test/parallel/test-vm-basic.js @@ -209,6 +209,20 @@ const vm = require('vm'); } ); + // Testing for non Array type-based failures + [Boolean(), Number(), null, Object(), Symbol(), {}].forEach( + (value) => { + common.expectsError(() => { + vm.compileFunction('', value); + }, { + type: TypeError, + code: 'ERR_INVALID_ARG_TYPE', + message: 'The "params" argument must be of type Array. ' + + `Received type ${typeof value}` + }); + } + ); + assert.strictEqual( vm.compileFunction( 'return a;', From c2f9eb930f1ba7edc3c49d8271ee9ee2a0acef9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CDan?= <dan.corman@gmail.com> Date: Wed, 14 Nov 2018 09:36:19 -0500 Subject: [PATCH 2/2] test: fix linter errors for compileFunction params test --- test/parallel/test-vm-basic.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/parallel/test-vm-basic.js b/test/parallel/test-vm-basic.js index 07344c6777ca49..29e2a8b5251934 100644 --- a/test/parallel/test-vm-basic.js +++ b/test/parallel/test-vm-basic.js @@ -209,19 +209,19 @@ const vm = require('vm'); } ); - // Testing for non Array type-based failures - [Boolean(), Number(), null, Object(), Symbol(), {}].forEach( - (value) => { - common.expectsError(() => { - vm.compileFunction('', value); - }, { - type: TypeError, - code: 'ERR_INVALID_ARG_TYPE', - message: 'The "params" argument must be of type Array. ' - + `Received type ${typeof value}` - }); - } - ); + // Testing for non Array type-based failures + [Boolean(), Number(), null, Object(), Symbol(), {}].forEach( + (value) => { + common.expectsError(() => { + vm.compileFunction('', value); + }, { + type: TypeError, + code: 'ERR_INVALID_ARG_TYPE', + message: 'The "params" argument must be of type Array. ' + + `Received type ${typeof value}` + }); + } + ); assert.strictEqual( vm.compileFunction(