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
947e747f
Commit
947e747f
authored
Aug 06, 2020
by
Paul Slaughter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add JSDoc for overclock_timers
parent
48b2783d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
spec/frontend_integration/test_helpers/utils/overclock_timers.js
...ontend_integration/test_helpers/utils/overclock_timers.js
+33
-0
No files found.
spec/frontend_integration/test_helpers/utils/overclock_timers.js
View file @
947e747f
/**
* This function replaces the existing `setTimeout` and `setInterval` with wrappers that
* discount the `ms` passed in by `boost`.
*
* For example, if a module has:
*
* ```
* setTimeout(cb, 100);
* ```
*
* But a test has:
*
* ```
* useOverclockTimers(25);
* ```
*
* Then the module's call to `setTimeout` effectively becomes:
*
* ```
* setTimeout(cb, 4);
* ```
*
* It's important to note that the timing for `setTimeout` and order of execution is non-deterministic
* and discounting the `ms` passed could make this very obvious and expose some underlying issues
* with flaky failures.
*
* WARNING: If flaky spec failures show up in a spec that is using this helper, please consider either:
*
* - Refactoring the production code so that it's reactive to state changes, not dependent on timers.
* - Removing the call to this helper from the spec.
*
* @param {Number} boost
*/
// eslint-disable-next-line import/prefer-default-export
export
const
useOverclockTimers
=
(
boost
=
50
)
=>
{
if
(
boost
<=
0
)
{
...
...
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