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

1
.gitignore vendored
View File

@@ -43,3 +43,4 @@ test/data/.temp
# Prevent unit test coverage reports from being added
.coverage
.nyc_output

View File

@@ -43,3 +43,4 @@ test/data/.temp
# Prevent unit test coverage reports from being added
.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-security": "1.4.0",
"expect.js": "0.3.1",
"istanbul": "0.4.5",
"nyc": "14.1.1",
"mocha": "5.2.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
if [ "$CI" = "true" ]; then
MOCHA_REPORTER="xunit";
ISTANBUL_REPORT="--report cobertura";
COVERAGE_REPORT="--report cobertura";
else
MOCHA_REPORTER="spec";
ISTANBUL_REPORT="";
COVERAGE_REPORT="";
fi
# delete old repor directory
[ -d .coverage ] && rm -rf .coverage && mkdir .coverage;
# run test
node --max-old-space-size=2048 node_modules/.bin/istanbul cover ${ISTANBUL_REPORT} \
--dir ./.coverage -x **/assets/** --print both _mocha -- \
node --max-old-space-size=2048 ./node_modules/.bin/nyc ${COVERAGE_REPORT} --report-dir ./.coverage \
-x **/assets/** --print both ./node_modules/.bin/_mocha \
--reporter ${MOCHA_REPORTER} --reporter-options output=${XUNIT_FILE} \
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
if [ "$CI" = "true" ]; then
MOCHA_REPORTER="xunit";
ISTANBUL_REPORT="--report cobertura";
COVERAGE_REPORT="--report cobertura";
else
MOCHA_REPORTER="spec";
ISTANBUL_REPORT="";
COVERAGE_REPORT="";
fi
# delete old repor directory
[ -d .coverage ] && rm -rf .coverage && mkdir .coverage;
# run test
node --max-old-space-size=2048 node_modules/.bin/istanbul cover ${ISTANBUL_REPORT} \
--dir ./.coverage -x **/assets/** --print both _mocha -- \
node --max-old-space-size=2048 ./node_modules/.bin/nyc ${COVERAGE_REPORT} --report-dir ./.coverage \
-x **/assets/** --print both ./node_modules/.bin/_mocha \
--reporter ${MOCHA_REPORTER} --reporter-options output=${XUNIT_FILE} \
test/unit/*.test.js --recursive --prof --grep "$1";