github-pages-deploy-action/node_modules/jest-circus
James Ives 5af4d9fc85 3.5.0 🎉
2020-05-14 17:33:08 -04:00
..
build 3.5.0 🎉 2020-05-14 17:33:08 -04:00
node_modules 3.5.0 🎉 2020-05-14 17:33:08 -04:00
LICENSE 3.4.3 2020-03-31 08:42:07 -04:00
package.json 3.5.0 🎉 2020-05-14 17:33:08 -04:00
README.md 3.4.9 2020-04-30 08:40:07 -04:00
runner.js 3.4.3 2020-03-31 08:42:07 -04:00

jest-circus

The next-gen test runner for Jest

Overview

Circus is a flux-based test runner for Jest that is fast, maintainable, and simple to extend.

Circus allows you to bind to events via an optional event handler on any custom environment. See the type definitions for more information on the events and state data currently available.

import NodeEnvironment from 'jest-environment-node';
import {Event, State} from 'jest-circus';

class MyCustomEnvironment extends NodeEnvironment {
  //...

  async handleTestEvent(event: Event, state: State) {
    if (event.name === 'test_start') {
      // ...
    }
  }
}

Mutating event or state data is currently unsupported and may cause unexpected behavior or break in a future release without warning. New events, event data, and/or state data will not be considered a breaking change and may be added in any minor release.

Note, that jest-circus test runner would pause until a promise returned from handleTestEvent gets fulfilled. However, there are a few events that do not conform to this rule, namely: start_describe_definition, finish_describe_definition, add_hook, add_test or error (for the up-to-date list you can look at SyncEvent type in the types definitions). That is caused by backward compatibility reasons and process.on('unhandledRejection', callback) signature, but that usually should not be a problem for most of the use cases.

Installation

Install jest-circus using yarn:

yarn add --dev jest-circus

Or via npm:

npm install --save-dev jest-circus

Configure

Configure Jest to use jest-circus via the testRunner option:

{
  "testRunner": "jest-circus/runner"
}

Or via CLI:

jest --testRunner='jest-circus/runner'