Report jest-junit testsuite errors as failures

Test errors are different (represented differently in the JUnit XML
output from jest-junit) to test _failures_. Failures are tests
which ran and failed, errors are for tests/test suites which
did not even run because the test code itself didn't build
or didn't execute correctly.

jest-junit has an option to enable reporting of test suite errors,
but test-reporter then interprets these as successful tests.
This commit is contained in:
John Bartholomew 2021-12-22 19:10:19 +00:00
parent 0d00bb14cb
commit fe8fe90f0e
9 changed files with 286 additions and 105 deletions

View file

@ -0,0 +1,3 @@
libs/bar.spec.ts
libs/foo.spec.ts
tsconfig.json

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="jest tests" tests="0" failures="0" errors="2" time="0.646">
<testsuite name="libs/foo.spec.ts" errors="1" failures="0" skipped="0" timestamp="1970-01-01T00:00:00" time="0" tests="0">
<testcase classname="Test suite failed to run" name="libs/foo.spec.ts" time="0">
<error> ● Test suite failed to run
tsconfig.json:13:3 - error TS6258: &apos;typeRoots&apos; should be set inside the &apos;compilerOptions&apos; object of the config json file
13 &quot;typeRoots&quot;: [&quot;./src/lib/types&quot;, &quot;./node_modules/@types&quot;],
~~~~~~~~~~~
</error>
</testcase>
</testsuite>
<testsuite name="libs/bar.spec.ts" errors="1" failures="0" skipped="0" timestamp="1970-01-01T00:00:00" time="0" tests="0">
<testcase classname="Test suite failed to run" name="libs/bar.spec.ts" time="0">
<error> ● Test suite failed to run
tsconfig.json:13:3 - error TS6258: &apos;typeRoots&apos; should be set inside the &apos;compilerOptions&apos; object of the config json file
13 &quot;typeRoots&quot;: [&quot;./src/lib/types&quot;, &quot;./node_modules/@types&quot;],
~~~~~~~~~~~
</error>
</testcase>
</testsuite>
</testsuites>