diff --git a/test/parallel/test-vm-function-declaration.js b/test/parallel/test-vm-function-declaration.js index 6405babfa78148..766e5ec78b10ea 100644 --- a/test/parallel/test-vm-function-declaration.js +++ b/test/parallel/test-vm-function-declaration.js @@ -28,17 +28,22 @@ const o = vm.createContext({ console }); // Function declaration and expression should both be copied to the // sandboxed context. -let code = 'var a = function() {};\n'; +let code = 'let a = function() {};\n'; code += 'function b(){}\n'; +code += 'var c = function() {};\n'; +code += 'var d = () => {};\n'; +code += 'let e = () => {};\n'; // Grab the global b function as the completion value, to ensure that // we are getting the global function, and not some other thing code += '(function(){return this})().b;\n'; const res = vm.runInContext(code, o, 'test'); - assert.strictEqual(typeof res, 'function'); assert.strictEqual(res.name, 'b'); -assert.strictEqual(typeof o.a, 'function'); +assert.strictEqual(typeof o.a, 'undefined'); assert.strictEqual(typeof o.b, 'function'); +assert.strictEqual(typeof o.c, 'function'); +assert.strictEqual(typeof o.d, 'function'); +assert.strictEqual(typeof o.e, 'undefined'); assert.strictEqual(res, o.b);