Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: use nyc instead of istanbul #11532

Merged
merged 2 commits into from Mar 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -16,3 +16,4 @@ versions.json
/.vscode
.sublimelinterrc
.eslint-release-info.json
.nyc_output
12 changes: 12 additions & 0 deletions .nycrc
@@ -0,0 +1,12 @@
{
"include": [
"bin/**/*.js",
"conf/**/*.js",
"lib/**/*.js"
],
"reporter": [
"lcov",
"text-summary"
],
"sourceMap": true
}
21 changes: 3 additions & 18 deletions Makefile.js
Expand Up @@ -66,7 +66,7 @@ const NODE = "node ", // intentional extra space
// Files
JSON_FILES = find("conf/").filter(fileType("json")),
MARKDOWN_FILES_ARRAY = find("docs/").concat(ls(".")).filter(fileType("md")),
TEST_FILES = getTestFilePatterns(),
TEST_FILES = "\"tests/{bin,lib,tools}/**/*.js\"",
PERF_ESLINTRC = path.join(PERF_TMP_DIR, "eslintrc.yml"),
PERF_MULTIFILES_TARGET_DIR = path.join(PERF_TMP_DIR, "eslint"),
PERF_MULTIFILES_TARGETS = `"${PERF_MULTIFILES_TARGET_DIR + path.sep}{lib,tests${path.sep}lib}${path.sep}**${path.sep}*.js"`,
Expand All @@ -78,20 +78,6 @@ const NODE = "node ", // intentional extra space
// Helpers
//------------------------------------------------------------------------------

/**
* Generates file patterns for test files
* @returns {string} test file patterns
* @private
*/
function getTestFilePatterns() {
return ls("tests/lib/").filter(pathToCheck => test("-d", `tests/lib/${pathToCheck}`)).reduce((initialValue, currentValues) => {
if (currentValues !== "rules") {
initialValue.push(`"tests/lib/${currentValues}/**/*.js"`);
}
return initialValue;
}, ["\"tests/lib/rules/**/*.js\"", "\"tests/lib/*.js\"", "\"tests/bin/**/*.js\"", "\"tests/tools/**/*.js\""]).join(" ");
}

/**
* Simple JSON file validation that relies on ES JSON parser.
* @param {string} filePath Path to JSON.
Expand Down Expand Up @@ -567,13 +553,12 @@ target.test = function() {

echo("Running unit tests");

lastReturn = exec(`${getBinFile("istanbul")} cover ${MOCHA} -- -R progress -t ${MOCHA_TIMEOUT} -c ${TEST_FILES}`);
lastReturn = exec(`${getBinFile("nyc")} -- ${MOCHA} -R progress -t ${MOCHA_TIMEOUT} -c ${TEST_FILES}`);
if (lastReturn.code !== 0) {
errors++;
}

lastReturn = exec(`${getBinFile("istanbul")} check-coverage --statement 99 --branch 98 --function 99 --lines 99`);

lastReturn = exec(`${getBinFile("nyc")} check-coverage --statement 99 --branch 98 --function 99 --lines 99`);
if (lastReturn.code !== 0) {
errors++;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -92,7 +92,6 @@
"eslint-release": "^1.2.0",
"eslump": "^2.0.0",
"esprima": "^4.0.1",
"istanbul": "^0.4.5",
"jsdoc": "^3.5.5",
"karma": "^3.1.4",
"karma-chrome-launcher": "^2.2.0",
Expand All @@ -105,6 +104,7 @@
"mocha": "^5.0.5",
"mock-fs": "^4.8.0",
"npm-license": "^0.3.3",
"nyc": "^13.3.0",
"proxyquire": "^2.0.1",
"puppeteer": "^1.12.2",
"shelljs": "^0.8.2",
Expand Down