Socket
Book a DemoInstallSign in
Socket

jest-junit

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-junit

A jest result processor that generates junit xml files

Source
npmnpm
Version
2.0.1
Version published
Weekly downloads
7M
-0.89%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

jest-junit

A Jest reporter that creates compatible junit xml files

Installation

yarn add --dev jest-junit

Usage

In your jest config add the following entry:

{
  "testResultsProcessor": "./node_modules/jest-junit"
}

Then simply run:

jest

Configuration

jest-junit offers five configurations based on environment variables. All are string values

Variable NameDefault
JEST_SUITE_NAME"jest tests"
JEST_JUNIT_OUTPUT"./junit.xml"
JEST_JUNIT_CLASSNAME"{classname} {title}"
JEST_JUNIT_TITLE"{classname} {title}"
JEST_USE_PATH_FOR_SUITE_NAME"false"

Example:

JEST_SUITE_NAME="Jest JUnit Unit Tests" JEST_JUNIT_OUTPUT="./artifacts/junit.xml" jest

You can also define a jest-junit key in your package.json. All are string values.

{
    ...
    "jest-junit": {
        "suiteName": "jest tests",
        "output": "./junit.xml",
        "classNameTemplate": "{classname}-{title}",
        "titleTemplate": "{classname}-{title}",
        "usePathForSuiteName": "true"
    }
}

Example output:

<testsuites name="Jest JUnit Unit Tests">
  <testsuite name="My first suite" tests="1" errors="0" failures="0" skipped="0" timestamp="2016-11-19T01:37:20" time="0.105">
    <testcase classname="My test case" name="My test case" time="6">
    </testcase>
  </testsuite>
</testsuites>

Changing the title and classname

JEST_JUNIT_CLASSNAME="{classname}" JEST_JUNIT_TITLE="{title}" jest
<testsuites name="jest tests">
  <testsuite name="foo" tests="1" errors="0" failures="0" skipped="0" timestamp="2017-02-19T22:36:15" time="0.232">
    <testcase classname="foo" name="bar" time="0.003">
    </testcase>
  </testsuite>
</testsuites>

FAQs

Package last updated on 13 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts