codeceptjs
Version:
Supercharged End 2 End Testing Framework for NodeJS
52 lines (36 loc) • 1.83 kB
Markdown
---
permalink: /plugins/junitReporter
editLink: false
sidebar: auto
title: junitReporter
---
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## junitReporter
Generates a JUnit-compatible XML report after a test run.
Unlike Mocha's `mocha-junit-reporter`, this plugin understands CodeceptJS steps and substeps.
For every `<testcase>` it includes:
* `<properties>` — the test's meta information: every `meta` key from `Scenario('...', { meta })`, plus its `tags` and `retries`
* `<system-out>` — an indented step/substep log (substeps are nested under their meta step); only failed steps are marked
* `<failure>` — for failed tests: the error message, type, stack trace and (optionally) the step trace
The produced file is consumable by Jenkins, GitLab CI, CircleCI, GitHub Actions test reporters, etc.
#### Configuration
```js
"plugins": {
"junitReporter": {
"enabled": true
}
}
```
Possible config options:
* `outputName`: file name for the report. Default: `report.xml`.
* `output`: directory where the report is stored, relative to the project root. Default: the `output` directory.
* `testGroupName`: value of the `name` attribute on the root `<testsuites>` element. Default: `CodeceptJS`.
* `attachMeta`: add the test's meta information (`meta` keys, `tags`, `retries`) as `<properties>`. Default: true.
* `attachSteps`: add the step/substep log as `<system-out>`. Default: true.
* `stepsInFailure`: append the step trace to the `<failure>` body. Default: true.
CLI examples:
npx codeceptjs run -p junitReporter
npx codeceptjs run -p junitReporter:outputName=junit.xml
> ℹ When running with `run-workers`, steps are serialized between processes and substep nesting is flattened.
### Parameters
* `config` **any**