Mocha
How to output test results to upload to Trunk
Mocha can be configured to produce JUnit XML output that Trunk can ingest by adding the mocha-junit-reporter
package to your codebase.
Now run Mocha from the command line or inside your CI system as:
Test Suite Naming
The mocha-junit-reporter
will automatically fill in values for the <testcase/>
and <testsuite/>
name
and class
attributes. The test:
will produce output that looks like this:
The default attributes can be configured with the reporterOptions
argument in the .mocharc.js
or similar config file.
By default Mocha will include the file
attribute.
Next Step
Once you've configured your test runner to output JUnit XML, you're ready to modify your CI test jobs to actually upload test results to Trunk. See CI Providers for instructions to do this for the CI system you use.
Last updated