Skip to content

Commit

Permalink
Chore: use nyc instead of istanbul (#11532)
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea authored Mar 22, 2019
1 parent f16af43 commit 4fe7eb7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ versions.json
/.vscode
.sublimelinterrc
.eslint-release-info.json
.nyc_output
12 changes: 12 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 4fe7eb7

Please sign in to comment.