GithubHelp home page GithubHelp logo

wesleym / jest-junit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jest-community/jest-junit

0.0 2.0 0.0 24 KB

A Jest reporter that creates compatible junit xml files

License: Apache License 2.0

JavaScript 100.00%

jest-junit's Introduction

jest-junit (unofficial test branch)

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.

JEST_SUITE_NAME: Default "jest tests"

JEST_JUNIT_OUTPUT: Default "./junit.xml"

JEST_JUNIT_CLASSNAME: Default "{classname}-{title}"

JEST_JUNIT_TITLE: Default "{classname}-{title}"

JEST_USE_PATH_FOR_SUITE_NAME: Default "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>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.