Commit ec29cdbc authored by Marcia Ramos's avatar Marcia Ramos
Browse files

Merge branch 'winh-this-jest-docs' into 'master'

Clarify that this.something is not available in Jest (docs)

Closes #24809

See merge request gitlab-org/gitlab-ce!29887
......@@ -32,6 +32,9 @@ we need to solve before being able to use Jest for all our needs.
The aliases used by Jest are defined in its [own config](
- All calls to `setTimeout` and `setInterval` are mocked away. See also [Jest Timer Mocks](
- `rewire` is not required because Jest supports mocking modules. See also [Manual Mocks](
- No [context object]( is passed to tests in Jest.
This means sharing `this.something` between `beforeEach()` and `it()` for example does not work.
Instead you should declare shared variables in the context that they are needed (via `const` / `let`).
- The following will cause tests to fail in Jest:
- Unmocked requests.
- Unhandled Promise rejections.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment