Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
tools: fixed jslint errors after merge
Browse files Browse the repository at this point in the history
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: #71
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Jianchun Xu <Jianchun.Xu@microsoft.com>
  • Loading branch information
kunalspathak committed May 17, 2016
1 parent 60e2711 commit b1e66d7
Show file tree
Hide file tree
Showing 16 changed files with 66 additions and 65 deletions.
2 changes: 1 addition & 1 deletion deps/chakrashim/lib/chakra_shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}

Expand Down
8 changes: 4 additions & 4 deletions test/parallel/test-buffer-slow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}));
}

Expand All @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions test/parallel/test-child-process-fork-exec-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 5 additions & 4 deletions test/parallel/test-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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()));
Expand All @@ -138,3 +138,4 @@ assert.throws(() => {
assert.doesNotThrow(() => {
console.assert(true, 'this should not throw');
});

4 changes: 2 additions & 2 deletions test/parallel/test-domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
});

Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-intl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-repl-harmony.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
52 changes: 26 additions & 26 deletions test/parallel/test-repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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; }',
Expand Down Expand Up @@ -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\'',
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-require-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
8 changes: 4 additions & 4 deletions test/parallel/test-tls-external-accessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
8 changes: 4 additions & 4 deletions test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {} }');
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-util-log.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }'},
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-vm-debug-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
8 changes: 4 additions & 4 deletions test/parallel/test-vm-new-script-new-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-process-warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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\.\<anonymous\>\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));
});
4 changes: 2 additions & 2 deletions test/sequential/test-regress-GH-4015.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});

0 comments on commit b1e66d7

Please sign in to comment.