From b1e66d751b415c8d8fbbe1f2e5101c3d1ebc864c Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Fri, 13 May 2016 10:44:56 -0700 Subject: [PATCH] tools: fixed jslint errors after merge Below are currently failing unit test cases ```cmd parallel/test-crypto-dh parallel/test-fs-stat parallel/test-fs-symlink parallel/test-promises-unhandled-rejections parallel/test-repl-mode parallel/test-repl-tab-complete parallel/test-regress-GH-746 parallel/test-regress-GH-io-1068 parallel/test-util-inspect-proxy parallel/test-vm-context parallel/test-vm-create-and-run-in-context parallel/test-vm-cached-data parallel/test-vm-global-identity parallel/test-vm-preserves-property parallel/test-vm-proxies parallel/test-vm-timeout addons/load-long-path/test known_issues/test-vm-function-redefinition sequential/test-vm-timeout-rethrow ``` PR-URL: nodejs/node-chakracore#71 Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Jianchun Xu --- deps/chakrashim/lib/chakra_shim.js | 2 +- test/parallel/test-buffer-slow.js | 8 +-- .../test-child-process-fork-exec-path.js | 8 +-- test/parallel/test-console.js | 9 ++-- test/parallel/test-domain.js | 4 +- test/parallel/test-intl.js | 4 +- test/parallel/test-repl-harmony.js | 4 +- test/parallel/test-repl.js | 52 +++++++++---------- test/parallel/test-require-json.js | 2 +- test/parallel/test-tls-external-accessor.js | 8 +-- test/parallel/test-util-inspect.js | 8 +-- test/parallel/test-util-log.js | 4 +- test/parallel/test-vm-debug-context.js | 4 +- .../test-vm-new-script-new-context.js | 8 +-- test/sequential/test-process-warnings.js | 2 +- test/sequential/test-regress-GH-4015.js | 4 +- 16 files changed, 66 insertions(+), 65 deletions(-) diff --git a/deps/chakrashim/lib/chakra_shim.js b/deps/chakrashim/lib/chakra_shim.js index 82645844a03..38f9b4121f5 100644 --- a/deps/chakrashim/lib/chakra_shim.js +++ b/deps/chakrashim/lib/chakra_shim.js @@ -310,7 +310,7 @@ function ensureDebug(otherGlobal) { if (!global.Debug) { Object_defineProperty(global, 'Debug', { - value: {}, enumerable : false, configurable : false, writable : false + value: {}, enumerable: false, configurable: false, writable: false }); } diff --git a/test/parallel/test-buffer-slow.js b/test/parallel/test-buffer-slow.js index e039d14a9e9..947348a41d0 100644 --- a/test/parallel/test-buffer-slow.js +++ b/test/parallel/test-buffer-slow.js @@ -36,8 +36,8 @@ try { SlowBuffer(buffer.kMaxLength).length, buffer.kMaxLength); } catch (e) { assert.equal(e.message, common.engineSpecificMessage({ - v8 : 'Array buffer allocation failed', - chakracore : 'Invalid offset/length when creating typed array' + v8: 'Array buffer allocation failed', + chakracore: 'Invalid offset/length when creating typed array' })); } @@ -53,8 +53,8 @@ assert.strictEqual(SlowBuffer('string').length, 0); // should throw with invalid length var expectedError = common.engineSpecificMessage({ - v8 : 'invalid Buffer length', - chakracore : 'Invalid offset/length when creating typed array' + v8: 'invalid Buffer length', + chakracore: 'Invalid offset/length when creating typed array' }); assert.throws(function() { SlowBuffer(Infinity); diff --git a/test/parallel/test-child-process-fork-exec-path.js b/test/parallel/test-child-process-fork-exec-path.js index 736230e3929..737d865a1bc 100644 --- a/test/parallel/test-child-process-fork-exec-path.js +++ b/test/parallel/test-child-process-fork-exec-path.js @@ -7,13 +7,13 @@ var msg = {test: 'this'}; var nodeCopyPath = path.join(common.tmpDir, 'node-copy.exe'); var chakracoreCopyPath = path.join(common.tmpDir, 'chakracore.dll'); var exePaths = [ - {srcPath : process.execPath, - destPath : nodeCopyPath}]; + {srcPath: process.execPath, + destPath: nodeCopyPath}]; if (common.isChakraEngine) { // chakra needs chakracore.dll as well exePaths.push( - {srcPath : process.execPath.replace('node.exe', 'chakracore.dll'), - destPath : chakracoreCopyPath}); + {srcPath: process.execPath.replace('node.exe', 'chakracore.dll'), + destPath: chakracoreCopyPath}); } if (process.env.FORK) { diff --git a/test/parallel/test-console.js b/test/parallel/test-console.js index 41616644175..b224bb24160 100644 --- a/test/parallel/test-console.js +++ b/test/parallel/test-console.js @@ -35,13 +35,11 @@ global.process.stderr.write = function(string) { errStrings.push(string); }; - var expectedFuncToString = common.engineSpecificMessage({ - v8 : "{ foo: 'bar', inspect: [Function] }\n", - chakracore : "{ foo: 'bar', inspect: [Function: inspect] }\n" + v8: "{ foo: 'bar', inspect: [Function] }\n", + chakracore: "{ foo: 'bar', inspect: [Function: inspect] }\n" }); - // test console.log() console.log('foo'); console.log('foo', 'bar'); @@ -118,6 +116,8 @@ for (const expected of expectedStrings) { assert.equal(expected + '\n', errStrings.shift()); // console.warn (stderr) } +assert.equal(expectedFuncToString, strings.shift()); +assert.equal(expectedFuncToString, strings.shift()); assert.notEqual(-1, strings.shift().indexOf('foo: [Object]')); assert.equal(-1, strings.shift().indexOf('baz')); assert.ok(/^label: \d+\.\d{3}ms$/.test(strings.shift().trim())); @@ -138,3 +138,4 @@ assert.throws(() => { assert.doesNotThrow(() => { console.assert(true, 'this should not throw'); }); + diff --git a/test/parallel/test-domain.js b/test/parallel/test-domain.js index 2df0b8fd14b..fd369ee533e 100644 --- a/test/parallel/test-domain.js +++ b/test/parallel/test-domain.js @@ -30,8 +30,8 @@ d.on('error', function(er) { } const typeErrMsg = common.engineSpecificMessage({ - v8 : "Cannot read property 'isDirectory' of undefined", - chakracore : "Unable to get property 'isDirectory' of undefined or\ + v8: "Cannot read property 'isDirectory' of undefined", + chakracore: "Unable to get property 'isDirectory' of undefined or\ null reference" }); diff --git a/test/parallel/test-intl.js b/test/parallel/test-intl.js index b3077bd7f14..59f25f81f81 100644 --- a/test/parallel/test-intl.js +++ b/test/parallel/test-intl.js @@ -5,8 +5,8 @@ var assert = require('assert'); // does node think that i18n was enabled? // for chakra i18n is enabled var enablei18n = common.engineSpecificMessage({ - v8 : process.config.variables.v8_enable_i18n_support, - chakracore : true + v8: process.config.variables.v8_enable_i18n_support, + chakracore: true }); if (enablei18n === undefined) { diff --git a/test/parallel/test-repl-harmony.js b/test/parallel/test-repl-harmony.js index d79ba6c5ee3..46011ca6d12 100644 --- a/test/parallel/test-repl-harmony.js +++ b/test/parallel/test-repl-harmony.js @@ -8,8 +8,8 @@ var child = spawn(process.execPath, args); var input = '(function(){"use strict"; const y=1;y=2})()\n'; var expectedOutput = common.engineSpecificMessage({ - v8 : /^> TypeError: Assignment to constant variable.\n/, - chakracore : /^> SyntaxError: Assignment to const\n/ + v8: /^> TypeError: Assignment to constant variable.\n/, + chakracore: /^> SyntaxError: Assignment to const\n/ }); child.stderr.setEncoding('utf8'); diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index dd9d70b570d..510e9e02d44 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -123,8 +123,8 @@ function error_test() { // But passing the same string to eval() should throw { client: client_unix, send: 'eval("function test_func() {")', expect: common.engineSpecificMessage({ - v8 : /^SyntaxError: Unexpected end of input/, - chakracore : /^SyntaxError: Expected '}'/}) + v8: /^SyntaxError: Unexpected end of input/, + chakracore: /^SyntaxError: Expected '}'/}) }, // Can handle multiline template literals { client: client_unix, send: '`io.js', @@ -155,66 +155,66 @@ function error_test() { // should throw { client: client_unix, send: 'JSON.parse(\'{invalid: \\\'json\\\'}\');', expect: common.engineSpecificMessage({ - v8 : /^SyntaxError: Unexpected token i/, - chakracore : /^SyntaxError: Invalid character/}) + v8: /^SyntaxError: Unexpected token i/, + chakracore: /^SyntaxError: Invalid character/}) }, // end of input to JSON.parse error is special case of syntax error, // should throw { client: client_unix, send: 'JSON.parse(\'066\');', expect: common.engineSpecificMessage({ - v8 : /^SyntaxError: Unexpected number/, - chakracore : /^SyntaxError: Invalid number/}) + v8: /^SyntaxError: Unexpected number/, + chakracore: /^SyntaxError: Invalid number/}) }, // should throw { client: client_unix, send: 'JSON.parse(\'{\');', expect: common.engineSpecificMessage({ - v8 : /^SyntaxError: Unexpected end of JSON input/, - chakracore : /^SyntaxError: Syntax error/}) + v8: /^SyntaxError: Unexpected end of JSON input/, + chakracore: /^SyntaxError: Syntax error/}) }, // invalid RegExps are a special case of syntax error, // should throw { client: client_unix, send: '/(/;', expect: common.engineSpecificMessage({ - v8 : /^SyntaxError: Invalid regular expression\:/, - chakracore : /^SyntaxError: Expected '\)' in regular expression/}) + v8: /^SyntaxError: Invalid regular expression\:/, + chakracore: /^SyntaxError: Expected '\)' in regular expression/}) }, // invalid RegExp modifiers are a special case of syntax error, // should throw (GH-4012) { client: client_unix, send: 'new RegExp("foo", "wrong modifier");', expect: common.engineSpecificMessage({ - v8 : /^SyntaxError: Invalid flags supplied to RegExp constructor/, - chakracore : /^SyntaxError: Syntax error in regular expression/}) + v8: /^SyntaxError: Invalid flags supplied to RegExp constructor/, + chakracore: /^SyntaxError: Syntax error in regular expression/}) }, // strict mode syntax errors should be caught (GH-5178) { client: client_unix, send: '(function() { "use strict"; return 0755; })()', expect: common.engineSpecificMessage({ - v8 : /^SyntaxError: Octal literals are not allowed in strict mode/, - chakracore : /^SyntaxError: Octal numeric literals and escape characters not allowed in strict mode/}) + v8: /^SyntaxError: Octal literals are not allowed in strict mode/, + chakracore: /^SyntaxError: Octal numeric literals and escape characters not allowed in strict mode/}) }, { client: client_unix, send: '(function(a, a, b) { "use strict"; return a + b + c; })()', expect: common.engineSpecificMessage({ - v8 : /^SyntaxError: Duplicate parameter name not allowed in this context/, - chakracore : /^SyntaxError: Duplicate formal parameter names not allowed in strict mode/}) + v8: /^SyntaxError: Duplicate parameter name not allowed in this context/, + chakracore: /^SyntaxError: Duplicate formal parameter names not allowed in strict mode/}) }, { client: client_unix, send: '(function() { "use strict"; with (this) {} })()', expect: common.engineSpecificMessage({ - v8 : /^SyntaxError: Strict mode code may not include a with statement/, - chakracore : /^SyntaxError: 'with' statements are not allowed in strict mode/}) + v8: /^SyntaxError: Strict mode code may not include a with statement/, + chakracore: /^SyntaxError: 'with' statements are not allowed in strict mode/}) }, { client: client_unix, send: '(function() { "use strict"; var x; delete x; })()', expect: common.engineSpecificMessage({ - v8 : /^SyntaxError: Delete of an unqualified identifier in strict mode/, - chakracore : /^SyntaxError: Calling delete on expression not allowed in strict mode/}) + v8: /^SyntaxError: Delete of an unqualified identifier in strict mode/, + chakracore: /^SyntaxError: Calling delete on expression not allowed in strict mode/}) }, { client: client_unix, send: '(function() { "use strict"; eval = 17; })()', expect: common.engineSpecificMessage({ - v8 : /^SyntaxError: Unexpected eval or arguments in strict mode/, - chakracore : /^SyntaxError: Invalid usage of 'eval' in strict mode/}) + v8: /^SyntaxError: Unexpected eval or arguments in strict mode/, + chakracore: /^SyntaxError: Invalid usage of 'eval' in strict mode/}) }, { client: client_unix, send: '(function() { "use strict"; if (true) function f() { } })()', expect: common.engineSpecificMessage({ - v8 : /^SyntaxError: In strict mode code, functions can only be declared at top level or immediately within another function/, - chakracore : /^SyntaxError: Syntax error/}) + v8: /^SyntaxError: In strict mode code, functions can only be declared at top level or immediately within another function/, + chakracore: /^SyntaxError: Syntax error/}) }, // Named functions can be used: { client: client_unix, send: 'function blah() { return 1; }', @@ -270,8 +270,8 @@ function error_test() { // fail when we are not inside a String and a line continuation is used { client: client_unix, send: '[] \\', expect: common.engineSpecificMessage({ - v8 : /^SyntaxError: Unexpected token ILLEGAL/, - chakracore : /^SyntaxError: Invalid character/}) + v8: /^SyntaxError: Unexpected token ILLEGAL/, + chakracore: /^SyntaxError: Invalid character/}) }, // do not fail when a String is created with line continuation { client: client_unix, send: '\'the\\\nfourth\\\neye\'', diff --git a/test/parallel/test-require-json.js b/test/parallel/test-require-json.js index 1efbacce5ad..a3846fd9221 100644 --- a/test/parallel/test-require-json.js +++ b/test/parallel/test-require-json.js @@ -7,7 +7,7 @@ try { } catch (err) { var re = common.engineSpecificMessage({ v8: /test[\/\\]fixtures[\/\\]invalid.json: Unexpected string/, - chakracore : /test[\/\\]fixtures[\/\\]invalid.json: Expected '}'/ + chakracore: /test[\/\\]fixtures[\/\\]invalid.json: Expected '}'/ }); var i = err.message.match(re); assert(null !== i, 'require() json error should include path'); diff --git a/test/parallel/test-tls-external-accessor.js b/test/parallel/test-tls-external-accessor.js index a60d9642d47..1f291b61239 100644 --- a/test/parallel/test-tls-external-accessor.js +++ b/test/parallel/test-tls-external-accessor.js @@ -14,15 +14,15 @@ const tls = require('tls'); const pctx = tls.createSecureContext().context; const cctx = Object.create(pctx); assert.throws(() => cctx._external, common.engineSpecificMessage({ - v8 : /incompatible receiver/, - chakracore : /Illegal invocation/})); + v8: /incompatible receiver/, + chakracore: /Illegal invocation/})); pctx._external; } { const pctx = tls.createSecurePair().credentials.context; const cctx = Object.create(pctx); assert.throws(() => cctx._external, common.engineSpecificMessage({ - v8 : /incompatible receiver/, - chakracore : /Illegal invocation/})); + v8: /incompatible receiver/, + chakracore: /Illegal invocation/})); pctx._external; } diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 7dbbada6479..0a8d5909776 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -31,8 +31,8 @@ assert.equal(util.inspect([1, [2, 3]]), '[ 1, [ 2, 3 ] ]'); assert.equal(util.inspect({}), '{}'); assert.equal(util.inspect({a: 1}), '{ a: 1 }'); assert.equal(util.inspect({a: function() {}}), common.engineSpecificMessage({ - v8 : '{ a: [Function] }', - chakracore : '{ a: [Function: a] }' + v8: '{ a: [Function] }', + chakracore: '{ a: [Function: a] }' })); assert.equal(util.inspect({a: 1, b: 2}), '{ a: 1, b: 2 }'); assert.equal(util.inspect({'a': {}}), '{ a: {} }'); @@ -222,8 +222,8 @@ assert.equal(util.inspect(value), '[ 1, 2, 3, growingLength: [Getter] ]'); value = function() {}; value.aprop = 42; assert.equal(util.inspect(value), common.engineSpecificMessage({ - v8 : '{ [Function] aprop: 42 }', - chakracore : '{ [Function: value] aprop: 42 }' + v8: '{ [Function] aprop: 42 }', + chakracore: '{ [Function: value] aprop: 42 }' })); // Regular expressions with properties diff --git a/test/parallel/test-util-log.js b/test/parallel/test-util-log.js index 1db100b1b35..54ea5882670 100644 --- a/test/parallel/test-util-log.js +++ b/test/parallel/test-util-log.js @@ -20,8 +20,8 @@ var tests = [ {input: false, output: 'false'}, {input: 42, output: '42'}, {input: function() {}, output: common.engineSpecificMessage({ - v8 : '[Function]', - chakracore : '[Function: input]' + v8: '[Function]', + chakracore: '[Function: input]' })}, {input: parseInt('not a number', 10), output: 'NaN'}, {input: {answer: 42}, output: '{ answer: 42 }'}, diff --git a/test/parallel/test-vm-debug-context.js b/test/parallel/test-vm-debug-context.js index c7e85346ea4..ff1142027f8 100644 --- a/test/parallel/test-vm-debug-context.js +++ b/test/parallel/test-vm-debug-context.js @@ -27,8 +27,8 @@ assert.throws(function() { vm.runInDebugContext('(function(f) { f(f) })(function(f) { f(f) })'); }, common.engineSpecificMessage({ - v8 : /RangeError/, - chakracore : /Error\: Out of stack space/ + v8: /RangeError/, + chakracore: /Error\: Out of stack space/ })); assert.equal(typeof vm.runInDebugContext('this'), 'object'); diff --git a/test/parallel/test-vm-new-script-new-context.js b/test/parallel/test-vm-new-script-new-context.js index 7fba08253ba..a1f65024337 100644 --- a/test/parallel/test-vm-new-script-new-context.js +++ b/test/parallel/test-vm-new-script-new-context.js @@ -26,8 +26,8 @@ assert.throws(function() { script.runInNewContext(); }, common.engineSpecificMessage({ - v8 : /not defined/, - chakracore : /undefined or null/ + v8: /not defined/, + chakracore: /undefined or null/ })); global.hello = 5; @@ -66,8 +66,8 @@ assert.throws(function() { script.runInNewContext(); }, common.engineSpecificMessage({ - v8 : /f is not defined/, - chakracore : /'a' of undefined or null/ + v8: /f is not defined/, + chakracore: /'a' of undefined or null/ })); console.error('invalid this'); diff --git a/test/sequential/test-process-warnings.js b/test/sequential/test-process-warnings.js index 853bb968703..4da07ae9419 100644 --- a/test/sequential/test-process-warnings.js +++ b/test/sequential/test-process-warnings.js @@ -31,6 +31,6 @@ execFile(node, traceWarn, function(er, stdout, stderr) { assert(/^\(.+\)\sWarning: a bad practice warning/.test(stderr)); assert(common.engineSpecificMessage({ v8: /at Object\.\\s\(.+warnings.js:3:9\)/, - chakracore:/at Anonymous function\s\(.+warnings.js:3:1\)/ + chakracore: /at Anonymous function\s\(.+warnings.js:3:1\)/ }).test(stderr)); }); diff --git a/test/sequential/test-regress-GH-4015.js b/test/sequential/test-regress-GH-4015.js index a1f9bf7f090..240588bd4a7 100644 --- a/test/sequential/test-regress-GH-4015.js +++ b/test/sequential/test-regress-GH-4015.js @@ -8,8 +8,8 @@ var cmd = '"' + process.execPath + '" ' + exec(cmd, function(err, stdout, stderr) { const expectedError = common.engineSpecificMessage({ - v8 : /RangeError: Maximum call stack size exceeded/, - chakracore : /Error: Out of stack space/ + v8: /RangeError: Maximum call stack size exceeded/, + chakracore: /Error: Out of stack space/ }); assert(expectedError.test(stderr)); });