ryparker / jest-circus-environment-template

A template for creating custom Jest Circus environments.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

A template for creating custom Jest Circus environments.


Languages

Language:JavaScript 81.3%Language:TypeScript 18.7%