From f2f46e87b6198fe8483c78955b419f3964d81ff2 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Wed, 20 Mar 2019 17:08:43 +0900 Subject: [PATCH 1/2] Chore: use nyc instead of istanbul --- .gitignore | 1 + .nycrc | 12 ++++++++++++ Makefile.js | 12 +++--------- package.json | 2 +- 4 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 .nycrc diff --git a/.gitignore b/.gitignore index d2c98d47bd9..c65d8d57358 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ versions.json /.vscode .sublimelinterrc .eslint-release-info.json +.nyc_output diff --git a/.nycrc b/.nycrc new file mode 100644 index 00000000000..d0f606dc2f6 --- /dev/null +++ b/.nycrc @@ -0,0 +1,12 @@ +{ + "include": [ + "bin/**/*.js", + "conf/**/*.js", + "lib/**/*.js" + ], + "reporter": [ + "lcov", + "text-summary" + ], + "sourceMap": true +} diff --git a/Makefile.js b/Makefile.js index bd6f4652461..2961188b1ec 100644 --- a/Makefile.js +++ b/Makefile.js @@ -84,12 +84,7 @@ const NODE = "node ", // intentional extra space * @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(" "); + return ["\"tests/lib/**/*.js\"", "\"tests/bin/**/*.js\"", "\"tests/tools/**/*.js\""].join(" "); } /** @@ -567,13 +562,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++; } diff --git a/package.json b/package.json index 6ef7e68ddc1..e76cbef38ed 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", From 7358def5b6749f8888f897a0b2772027ad1ff202 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sat, 23 Mar 2019 08:03:35 +0900 Subject: [PATCH 2/2] simplify tests files notation --- Makefile.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Makefile.js b/Makefile.js index 2961188b1ec..fd501857e00 100644 --- a/Makefile.js +++ b/Makefile.js @@ -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"`, @@ -78,15 +78,6 @@ const NODE = "node ", // intentional extra space // Helpers //------------------------------------------------------------------------------ -/** - * Generates file patterns for test files - * @returns {string} test file patterns - * @private - */ -function getTestFilePatterns() { - return ["\"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.