Package detail

jest-wip-reporter

kevinrutherford1.4kGPL-3.0-or-later2.1.0

A Jest reporter that treats all incomplete tests as WIP

Jest, WIP

readme

jest-wip-reporter

npm version Downloads

An opinionated Jest reporter that treats all incomplete tests as WIP.

Philosophy

This reporter considers every test to be in one of three states: passing, failing, or WIP (work in progress). WIP tests represent work that is still to be finished; they won't fail your build, but the reporter will call them out and remind you loudly that your work isn't done yet.

In Jest terms, this reporter marks a test as WIP if it:

  • is marked as .todo, .failing or .skip, or
  • is skipped due to some other describe or it being marked with .only, or
  • contains no assertions.

Note that a .failing test that Jest would report as "passing" (because the test run failed) will be marked as WIP by this reporter, because the work related to it is not yet finished.

Output

image

The report generated comprises four parts:

  1. A progress report in which the outcome of each test is represented by a single character:

    • Passing: a green '.'
    • WIP: an amber '?'
    • Failing: a red 'x'
  2. A summary of WIP tests.

  3. Details of any failures.

  4. A summary of the test run.

Configuring the progress report

By default the reporter emits a single character when each test runs:

  • Passing: a green '.'
  • WIP: an amber '?'
  • Failing: a red 'x'

In this default view, the output contains a single character for each test, but describe blocks and test names are not represented.

If you need to see more context, the progress report can be configured to emit a tree of nested describe and test names by setting the environment variable $JWR_PROGRESS to tree (the default value is dots).

In the tree report, each describe is coloured to match the "worst" outcome of the tests it contains. For example, a describe block containing a WIP test and a failing test would be rendered as failing, because a failing test is "worse" than a WIP test.

Configuring the WIP report

If you have any WIP tests, by default this reporter will list them as a tree of nested describe and test titles. To replace this with a flat list of fully-qualified test names set the environment variable $JWR_WIP_REPORT to list (the default value is tree).

Installation

Install as a development dependency:

npm install --save-dev jest-simple-dot-reporter

or

yarn add --dev jest-simple-dot-reporter

Then configure Jest to use this reporter.

For example, create a jest.config.js file containing:

module.exports = {
  "verbose": false,
  "reporters": [
    "jest-wip-reporter",
  ]
};

changelog

Change Log

2.1.0 (2023-09-26)

Changed

  • Displays "0 run" when there are no tests

2.0.0 (2023-09-22)

Changed

  • The WIP report is now tree-shaped by default
  • Set $JWR_WIP_REPORT=list to display the WIP report in the old format (full titles)
  • When $JWR_PROGRESS=tree, test suites are coloured to match the "worst" outcome they contain

1.1.1 (2023-09-13)

Changed

  • Report tests that have been skipped with it.skip

1.1.0 (2023-09-11)

Changed

  • Always add tests to the tree when $JWR_PROGRESS=tree

1.0.0 (2023-09-11)

Changed

  • Replace $JWR_VERBOSE with $JWR_PROGRESS

0.2.1 (2023-09-07)

Changed

  • In verbose mode, test results are listed as an indented "tree" of describe blocks
  • In verbose mode, passing tests are marked with a ✓ symbol
  • A test with no passing assertions is now deemed to be WIP

0.1.1 (2023-08-21)

Changed

  • Typo in the README

0.1.0 (2023-08-21)

Added

  • Basic run display, modelled on JUnit v1
  • Display fully qualified test names if $JWR_VERBOSE is set
  • Display the fully qualified names of any WIP tests in the run summary
  • Classify a passing test with 0 passing assertions as WIP

0.0.1 (2023-08-14)

Added

  • Empty package