jest-mocha-reporter

A reporter for jest which produces a report compatible with Atlassian Bamboo Mocha Test Parser.

Usage no npm install needed!

<script type="module">
  import jestMochaReporter from 'https://cdn.skypack.dev/jest-mocha-reporter';
</script>

README

jest-mocha-reporter

A reporter for jest which produces a report compatible with Atlassian Bamboo Mocha Test Parser.

This is compatible with both reporter and testResultsProcessor

See Reporters

See testResultsProcessor

Build Status

Forked From

Installation

npm install --save-dev jest-mocha-reporter

Usage

In the jest config file add the path to the module.

If you are using testResultsProcessor:

{
    "testResultsProcessor": "jest-mocha-reporter"
}

If you are using Reporters:

{
    "reporter": "jest-mocha-reporter"
}

See Configuring Jest.

Configuration

The name of test suite and separator can be customized by setting the environment variables

JEST_MOCHA_SUITE_NAME="{fileNameWithoutExtension}" JEST_MOCHA_NAME_SEPARATOR=" >> " jest

JEST_MOCHA_SUITE_NAME supports following variables

  • firstAncestorTitle: The name of the outermost "describe" group
  • filePath: Full path of the test
  • fileName: File name of the test
  • fileNameWithoutExtension: File name of the test without extension

Also, variable supports fallback. For example: {firstAncestorTitle|filename} means use file name of the test if it doesn't have a group name.

Output

By default, the reporter writes to test-report.json. The file name can be changed by setting the JEST_REPORT_FILE environment variable.

JEST_REPORT_FILE="./jest-report.json" jest

License

MIT