mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
test: use eslint to fix var->const/let
Manually fix issues that eslint --fix couldn't do automatically. Backport-PR-URL: https://github.com/nodejs/node/pull/11775 PR-URL: https://github.com/nodejs/node/pull/10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
This commit is contained in:
1 parent
de63698066
commit
db61c952de
806 files changed
+5031
-4995
No files matched your search
@@ -5,10 +5,10 @@ const assert = require('assert');
|
||||
const spawnSync = require('child_process').spawnSync;
|
||||
const path = require('path');
|
||||
|
||||
var node = process.execPath;
|
||||
const node = process.execPath;
|
||||
|
||||
// test both sets of arguments that check syntax
|
||||
var syntaxArgs = [
|
||||
const syntaxArgs = [
|
||||
['-c'],
|
||||
['--check']
|
||||
];
|
||||
@@ -25,8 +25,8 @@ var syntaxArgs = [
|
||||
|
||||
// loop each possible option, `-c` or `--check`
|
||||
syntaxArgs.forEach(function(args) {
|
||||
var _args = args.concat(file);
|
||||
var c = spawnSync(node, _args, {encoding: 'utf8'});
|
||||
const _args = args.concat(file);
|
||||
const c = spawnSync(node, _args, {encoding: 'utf8'});
|
||||
|
||||
// no output should be produced
|
||||
assert.strictEqual(c.stdout, '', 'stdout produced');
|
||||
@@ -46,14 +46,14 @@ var syntaxArgs = [
|
||||
|
||||
// loop each possible option, `-c` or `--check`
|
||||
syntaxArgs.forEach(function(args) {
|
||||
var _args = args.concat(file);
|
||||
var c = spawnSync(node, _args, {encoding: 'utf8'});
|
||||
const _args = args.concat(file);
|
||||
const c = spawnSync(node, _args, {encoding: 'utf8'});
|
||||
|
||||
// no stdout should be produced
|
||||
assert.strictEqual(c.stdout, '', 'stdout produced');
|
||||
|
||||
// stderr should have a syntax error message
|
||||
var match = c.stderr.match(/^SyntaxError: Unexpected identifier$/m);
|
||||
const match = c.stderr.match(/^SyntaxError: Unexpected identifier$/m);
|
||||
assert(match, 'stderr incorrect');
|
||||
|
||||
assert.strictEqual(c.status, 1, 'code == ' + c.status);
|
||||
@@ -69,14 +69,14 @@ var syntaxArgs = [
|
||||
|
||||
// loop each possible option, `-c` or `--check`
|
||||
syntaxArgs.forEach(function(args) {
|
||||
var _args = args.concat(file);
|
||||
var c = spawnSync(node, _args, {encoding: 'utf8'});
|
||||
const _args = args.concat(file);
|
||||
const c = spawnSync(node, _args, {encoding: 'utf8'});
|
||||
|
||||
// no stdout should be produced
|
||||
assert.strictEqual(c.stdout, '', 'stdout produced');
|
||||
|
||||
// stderr should have a module not found error message
|
||||
var match = c.stderr.match(/^Error: Cannot find module/m);
|
||||
const match = c.stderr.match(/^Error: Cannot find module/m);
|
||||
assert(match, 'stderr incorrect');
|
||||
|
||||
assert.strictEqual(c.status, 1, 'code == ' + c.status);
|
||||
|
||||
Reference in new issue
Block a user