Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1eccad79
Commit
1eccad79
authored
Jun 25, 2019
by
Winnie Hellmann
Committed by
Marcia Ramos
Jun 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify that this.something is not available in Jest (docs)
parent
59a53e13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
doc/development/testing_guide/frontend_testing.md
doc/development/testing_guide/frontend_testing.md
+3
-0
No files found.
doc/development/testing_guide/frontend_testing.md
View file @
1eccad79
...
...
@@ -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
](
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/jest.config.js
)
.
-
All calls to
`setTimeout`
and
`setInterval`
are mocked away. See also
[
Jest Timer Mocks
](
https://jestjs.io/docs/en/timer-mocks
)
.
-
`rewire`
is not required because Jest supports mocking modules. See also
[
Manual Mocks
](
https://jestjs.io/docs/en/manual-mocks
)
.
-
No
[
context object
](
https://jasmine.github.io/tutorials/your_first_suite#section-The_%3Ccode%3Ethis%3C/code%3E_keyword
)
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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment