Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

A template for creating custom Jest Circus environments.

Notifications You must be signed in to change notification settings

ryparker/jest-circus-environment-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jest Circus environment template

jest XO code style

A template for creating custom Jest Circus environments.

🗒️ Gist

If you'd rather not use this template, here is a Gist with the main interface for creating a Jest environment.

🚀 Quick start

  1. Clone
git clone https://github.com/ryparker/jest-circus-environment-template.git jest-circus-environment && cd jest-circus-environment
  1. Install dependencies
yarn install
  1. Transpile to JS
yarn build

🔧 Using the environment

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.

Lifecycle events

Updated list available here

Bold items are async test events Italic items are synchronous test events

  1. error
  2. constructor
  3. setup Fn
  4. setup
  5. add_hook
  6. start_describe_definition
  7. add_test
  8. finish_describe_definition
  9. run_start / test_skip / test_todo
  10. run_describe_start
  11. test_start
  12. hook_start
  13. hook_success / hook_failure
  14. test_fn_start
  15. test_fn_success / test_fn_failure / error
  16. test_done
  17. run_describe_finish
  18. run_finish
  19. teardown
  20. teardown Fn

Related Projects

Jest Reporter: Template Project | Gist