A template for creating custom Jest Circus environments.
If you'd rather not use this template, here is a Gist with the main interface for creating a Jest environment.
- Clone
git clone https://github.com/ryparker/jest-circus-environment-template.git jest-circus-environment && cd jest-circus-environment
- Install dependencies
yarn install
- Transpile to JS
yarn build
You will will need to add the environment's path to the testEnvironment
option in your jest.config.js
.
{
"testEnvironment": "<rootDir>/my-custom-environment.js",
"testRunner": "jest-circus/runner"
}
See the official Jest docs for more details.
Updated list available here
Bold items are async test events Italic items are synchronous test events
- error
- constructor
- setup Fn
- setup
- add_hook
- start_describe_definition
- add_test
- finish_describe_definition
- run_start / test_skip / test_todo
- run_describe_start
- test_start
- hook_start
- hook_success / hook_failure
- test_fn_start
- test_fn_success / test_fn_failure / error
- test_done
- run_describe_finish
- run_finish
- teardown
- teardown Fn
Jest Reporter: Template Project | Gist