mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 07:00:59 +01:00
test: add common.skipIfEslintMissing
We've added a number of tests that hook into ESLint which can error when running the test suite with the distributed tarball. This PR adds a new test helper `common.skipIfEslintMissing` and will skip remaining tests in a file when `ESLint` is not available at `tools/node_modules/eslint` PR-URL: https://github.com/nodejs/node/pull/18807 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
6ab288f3b8
commit
1fd69872e6
@ -353,6 +353,11 @@ Path to the 'root' directory. either `/` or `c:\\` (windows)
|
||||
|
||||
Logs '1..0 # Skipped: ' + `msg` and exits with exit code `0`.
|
||||
|
||||
### skipIfEslintMissing()
|
||||
|
||||
Skip the rest of the tests in the current file when `ESLint` is not available
|
||||
at `tools/node_modules/eslint`
|
||||
|
||||
### skipIfInspectorDisabled()
|
||||
|
||||
Skip the rest of the tests in the current file when the Inspector
|
||||
|
@ -494,6 +494,14 @@ exports.fileExists = function(pathname) {
|
||||
}
|
||||
};
|
||||
|
||||
exports.skipIfEslintMissing = function() {
|
||||
if (!exports.fileExists(
|
||||
path.join('..', '..', 'tools', 'node_modules', 'eslint')
|
||||
)) {
|
||||
exports.skip('missing ESLint');
|
||||
}
|
||||
};
|
||||
|
||||
exports.canCreateSymLink = function() {
|
||||
// On Windows, creating symlinks requires admin privileges.
|
||||
// We'll only try to run symlink test if we have enough privileges.
|
||||
|
@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const common = require('../common');
|
||||
|
||||
common.skipIfEslintMissing();
|
||||
|
||||
const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
|
||||
const rule = require('../../tools/eslint-rules/crypto-check');
|
||||
|
@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const common = require('../common');
|
||||
|
||||
common.skipIfEslintMissing();
|
||||
|
||||
const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
|
||||
const rule = require('../../tools/eslint-rules/lowercase-name-for-primitive');
|
||||
|
@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const common = require('../common');
|
||||
|
||||
common.skipIfEslintMissing();
|
||||
|
||||
const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
|
||||
const rule = require('../../tools/eslint-rules/no-let-in-for-declaration');
|
||||
|
@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const common = require('../common');
|
||||
|
||||
common.skipIfEslintMissing();
|
||||
|
||||
const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
|
||||
const rule = require('../../tools/eslint-rules/no-unescaped-regexp-dot');
|
||||
|
@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const common = require('../common');
|
||||
|
||||
common.skipIfEslintMissing();
|
||||
|
||||
const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
|
||||
const rule = require('../../tools/eslint-rules/number-isnan');
|
||||
|
@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const common = require('../common');
|
||||
|
||||
common.skipIfEslintMissing();
|
||||
|
||||
const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
|
||||
const rule = require('../../tools/eslint-rules/prefer-assert-iferror');
|
||||
|
@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const common = require('../common');
|
||||
|
||||
common.skipIfEslintMissing();
|
||||
|
||||
const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
|
||||
const rule = require('../../tools/eslint-rules/prefer-assert-methods');
|
||||
|
@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const common = require('../common');
|
||||
|
||||
common.skipIfEslintMissing();
|
||||
|
||||
const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
|
||||
const rule = require('../../tools/eslint-rules/prefer-common-expectserror');
|
||||
|
@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const common = require('../common');
|
||||
|
||||
common.skipIfEslintMissing();
|
||||
|
||||
const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
|
||||
const rule = require('../../tools/eslint-rules/prefer-common-mustnotcall');
|
||||
|
@ -2,7 +2,9 @@
|
||||
|
||||
/* eslint-disable no-template-curly-in-string */
|
||||
|
||||
require('../common');
|
||||
const common = require('../common');
|
||||
|
||||
common.skipIfEslintMissing();
|
||||
|
||||
const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
|
||||
const rule = require('../../tools/eslint-rules/prefer-util-format-errors');
|
||||
|
@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const common = require('../common');
|
||||
|
||||
common.skipIfEslintMissing();
|
||||
|
||||
const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
|
||||
const rule = require('../../tools/eslint-rules/require-buffer');
|
||||
|
@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const common = require('../common');
|
||||
|
||||
common.skipIfEslintMissing();
|
||||
|
||||
const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
|
||||
const rule = require('../../tools/eslint-rules/required-modules');
|
||||
|
Loading…
Reference in New Issue
Block a user