Skip to content

Commit f08e8af

Browse files
committed
npm: support TAP and JUnit generation in the CI
Otherwise, it will change the local development workflow this will be less intrusive and avoid running coverage or tap/junit transformation as part of the normal development workflow easy to reproduce by running CI=true npm test
1 parent 16235e5 commit f08e8af

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

test/script/run_tests.sh

+18-4
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,24 @@ run_test_suite () {
4747

4848
npm run test:deps
4949

50-
rm -rf ./test_output
51-
mkdir ./test_output
52-
nyc node test/test.js -o ./test_output
53-
ls test_output/*.tap | while read f; do cat $f | ./node_modules/.bin/tap-junit > $f.junit.xml; done
50+
# If running in CI, then output .tap files and covert them to JUnit
51+
# format for test reporting.
52+
local testArgs=""
53+
if [[ -n "$CI" ]]; then
54+
rm -rf ./test_output
55+
mkdir ./test_output
56+
testArgs="-o ./test_output"
57+
fi
58+
59+
if [[ -n "$COVERAGE" ]]; then
60+
nyc node test/test.js $testArgs
61+
else
62+
node test/test.js $testArgs
63+
fi
64+
65+
if [[ -n "$CI" ]]; then
66+
ls test_output/*.tap | while read f; do cat $f | ./node_modules/.bin/tap-junit > $f.junit.xml; done
67+
fi
5468

5569
npm run test:types
5670
if [[ $major_node_version -ne 13 ]] || [[ $minor_node_version -gt 1 ]]; then

0 commit comments

Comments
 (0)