Updated code coverage tool from deprecated istanbul to nyc

This commit is contained in:
Vishal Shingala
2020-08-11 21:09:13 +05:30
parent 5d190efbf0
commit 46a13c4fef
6 changed files with 875 additions and 180 deletions

3
.gitignore vendored
View File

@@ -42,4 +42,5 @@ test/data/.temp
*.orig *.orig
# Prevent unit test coverage reports from being added # Prevent unit test coverage reports from being added
.coverage .coverage
.nyc_output

View File

@@ -42,4 +42,5 @@ test/data/.temp
*.orig *.orig
# Prevent unit test coverage reports from being added # Prevent unit test coverage reports from being added
.coverage .coverage
.nyc_output

1029
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -136,7 +136,7 @@
"eslint-plugin-mocha": "5.2.0", "eslint-plugin-mocha": "5.2.0",
"eslint-plugin-security": "1.4.0", "eslint-plugin-security": "1.4.0",
"expect.js": "0.3.1", "expect.js": "0.3.1",
"istanbul": "0.4.5", "nyc": "14.1.1",
"mocha": "5.2.0", "mocha": "5.2.0",
"parse-gitignore": "0.4.0" "parse-gitignore": "0.4.0"
}, },

View File

@@ -28,17 +28,17 @@ echo -en "\033[0m\033[2mmocha `mocha --version`\033[0m";
# set mocha reporter # set mocha reporter
if [ "$CI" = "true" ]; then if [ "$CI" = "true" ]; then
MOCHA_REPORTER="xunit"; MOCHA_REPORTER="xunit";
ISTANBUL_REPORT="--report cobertura"; COVERAGE_REPORT="--report cobertura";
else else
MOCHA_REPORTER="spec"; MOCHA_REPORTER="spec";
ISTANBUL_REPORT=""; COVERAGE_REPORT="";
fi fi
# delete old repor directory # delete old repor directory
[ -d .coverage ] && rm -rf .coverage && mkdir .coverage; [ -d .coverage ] && rm -rf .coverage && mkdir .coverage;
# run test # run test
node --max-old-space-size=2048 node_modules/.bin/istanbul cover ${ISTANBUL_REPORT} \ node --max-old-space-size=2048 ./node_modules/.bin/nyc ${COVERAGE_REPORT} --report-dir ./.coverage \
--dir ./.coverage -x **/assets/** --print both _mocha -- \ -x **/assets/** --print both ./node_modules/.bin/_mocha \
--reporter ${MOCHA_REPORTER} --reporter-options output=${XUNIT_FILE} \ --reporter ${MOCHA_REPORTER} --reporter-options output=${XUNIT_FILE} \
test/system/*.test.js --recursive --prof --grep "$1"; test/system/*.test.js --recursive --prof --grep "$1";

View File

@@ -27,17 +27,17 @@ echo -en "\033[0m\033[2mmocha `mocha --version`\033[0m";
# set mocha reporter # set mocha reporter
if [ "$CI" = "true" ]; then if [ "$CI" = "true" ]; then
MOCHA_REPORTER="xunit"; MOCHA_REPORTER="xunit";
ISTANBUL_REPORT="--report cobertura"; COVERAGE_REPORT="--report cobertura";
else else
MOCHA_REPORTER="spec"; MOCHA_REPORTER="spec";
ISTANBUL_REPORT=""; COVERAGE_REPORT="";
fi fi
# delete old repor directory # delete old repor directory
[ -d .coverage ] && rm -rf .coverage && mkdir .coverage; [ -d .coverage ] && rm -rf .coverage && mkdir .coverage;
# run test # run test
node --max-old-space-size=2048 node_modules/.bin/istanbul cover ${ISTANBUL_REPORT} \ node --max-old-space-size=2048 ./node_modules/.bin/nyc ${COVERAGE_REPORT} --report-dir ./.coverage \
--dir ./.coverage -x **/assets/** --print both _mocha -- \ -x **/assets/** --print both ./node_modules/.bin/_mocha \
--reporter ${MOCHA_REPORTER} --reporter-options output=${XUNIT_FILE} \ --reporter ${MOCHA_REPORTER} --reporter-options output=${XUNIT_FILE} \
test/unit/*.test.js --recursive --prof --grep "$1"; test/unit/*.test.js --recursive --prof --grep "$1";