Step 2 - Setup `useFakeDate` by default in Jest
- Step 1 - Add fake_date test helper
- Step 2 - Setup
useFakeDate
by default in Jest Step 3 - Update default fake date to match rspec fixtures- Step 3 - Add helper for
useFixturesFakeDate
What does this MR do?
This MR sets up useFakeDate
by default in our Jest environment
Merge request reports
Activity
changed milestone to %13.3
added master:broken priority1 severity1 typefeature typemaintenance labels
- Resolved by Paul Slaughter
todo: Change the docs to describe opting out with
useRealDate
if this MR works out.
added documentation label
1 Warning This merge request changed files with disabled eslint rules. Please consider fixing them. 1 Message This merge request adds or changes documentation files. A review from the Technical Writing team before you merge is recommended. Reviews can happen after you merge. Documentation review
The following files require a review from a technical writer:
doc/development/testing_guide/frontend_testing.md
The review does not need to block merging this merge request. See the:
- Technical Writers assignments for the appropriate technical writer for this review.
- Documentation workflows for information on when to assign a merge request for review.
Disabled eslint rules
The following files have disabled
eslint
rules. Please consider fixing them:spec/frontend/environment.js
Run the following command for more details
node_modules/.bin/eslint --report-unused-disable-directives --no-inline-config \ 'spec/frontend/environment.js'
Reviewer roulette
Changes that require review have been detected! A merge request is normally reviewed by both a reviewer and a maintainer in its primary category (e.g. frontend or backend), and by a maintainer in all other categories.
To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.
Once you've decided who will review this merge request, mention them as you normally would! Danger does not automatically notify them for you.
Category Reviewer Maintainer frontend Doug Stull ( @dstull
) (UTC-5, 1 hour ahead of@pslaughter
)Tim Zallmann ( @timzallmann
) (UTC+1, 7 hours ahead of@pslaughter
)If needed, you can retry the
danger-review
job that generated this comment.Generated by
DangerEdited by 🤖 GitLab Bot 🤖assigned to @pslaughter
added frontend tooling (archive) labels and removed documentation master:broken priority1 severity1 typefeature typemaintenance labels
added groupeditor [DEPRECATED] label
mentioned in merge request !39495 (merged)
added sectiondev label
marked as a Work In Progress from f87b6ee7
added documentation label
added 873 commits
-
2969d3a2...c3091d4b - 870 commits from branch
master
- 0fdbd404 - Add fake_date test helper and use it in spec
- 4dab808f - Add docs for useFakeDate
- 1c9d2beb - Add useFakeDate in test_setup
Toggle commit list-
2969d3a2...c3091d4b - 870 commits from branch
added 1 commit
- 4d7e420c - fixup! Add fake_date test helper and use it in spec
added 1 commit
- 16d39cc7 - fixup! Add fake_date test helper and use it in spec
changed milestone to %13.4
added missed:13.3 label
- Resolved by Paul Slaughter
@markrian just a heads up that I'm going to be OOO for a bit so this will be "on hold"... Feel free to pick it up while I'm gone if you feel so inspired
context for future readers: I'm a bit nervous about how this will work with non-deterministic dates in RSpec fixtures? Does RSpec fixtures have deterministic dates? If not, how easy is it for us to set a fixed date there?
mentioned in issue #236004 (closed)
mentioned in commit a2dcadde
mentioned in commit af809e8d
Setting label(s) devopscreate based on ~"group::editor".
added devopscreate label
changed milestone to %13.5
added missed:13.4 label
changed milestone to %13.6
added missed:13.5 label
mentioned in merge request !46569 (merged)
changed milestone to %13.7
added missed:13.6 label
changed milestone to %13.8
added missed:13.7 label
changed milestone to %13.9
added missed:13.8 label
- Resolved by Paul Slaughter
@pslaughter WDYT of resurrecting this? Especially since we now use Jest 26.x, we can make use of
jest.useFakeTimers('modern')
together withjest.setSystemTime(number | Date)
Edited by Mark Florian
removed missed:13.8 label
removed missed:13.7 label
removed missed:13.6 label
removed missed:13.5 label
removed missed:13.4 label
removed missed:13.3 label
added 28010 commits
-
737d696c...fd1c8b16 - 28007 commits from branch
master
- 7389dbd6 - Add useFakeDate in test_setup
- dd1710c6 - Update jest fake_date for rspec consistency
- 45f443e5 - Fix specs for global useFakeDate
Toggle commit list-
737d696c...fd1c8b16 - 28007 commits from branch
Consider this MR resurrected!
@markrian would you mind taking a look? There might be a test failure or two in CI, but I think I caught most of them
assigned to @markrian
added backend label
- Resolved by Mark Florian
- Resolved by Mark Florian
- Resolved by Paul Slaughter
- Resolved by Paul Slaughter
added 95 commits
-
45f443e5...3b692a28 - 92 commits from branch
master
- ea075f65 - Add useFakeDate in test_setup
- e51654c1 - Update jest fake_date for rspec consistency
- a1a8f491 - Fix specs for global useFakeDate
Toggle commit list-
45f443e5...3b692a28 - 92 commits from branch
added 2 commits
- Resolved by Paul Slaughter
- Resolved by Paul Slaughter
- Resolved by Paul Slaughter
- Resolved by Paul Slaughter
- Resolved by Paul Slaughter
Thanks @pslaughter! On the whole this looks great, but I am concerned about the non-local effects of
useFakeDate
. That it doesn't affect only the scope you call it in leads to some potential surprises/gotchas that I think we should try to avoid.This is actually something your
useSmartResource
would be ideally suited to, but I got the impression other engineers pushed back against itLet me know your thoughts!
Edited by Mark Florianunassigned @markrian
added 627 commits
Toggle commit listmentioned in merge request !53540 (closed)
added 2 commits
It probably doesn't matter, but maybe the frontend and backend should use the same fixed date of
2015-07-03T10:00:00.000Z
?update: To help with cutting down the size of this MR, I moved this to a new step !53540 (closed)
The focus of this MR is now just
setGlobalDateToFakeDate
intest_setup
andenvironmnet
+ makeuseFakeDate
clean up after itself.- Resolved by Mark Florian
- Resolved by Mark Florian
- Resolved by Mark Florian
- Resolved by Mark Florian
- Resolved by Mark Florian
- Resolved by Mark Florian
- Resolved by Mark Florian
- Resolved by Mark Florian
Thanks so much for the review, collaboration, and thoughtful comments @markrian! As we talked synchronously, I've updated the approach (please see !39496 (comment 503084734)).
Also, please note that I moved updating the default date to
2015-07-03T10:00:00.000Z
to a follow-up MR. I feel a lot better about this approach and updating the existing specs, I can already tell it's a lot more robust and intuitive. WDYT?Back to you!
assigned to @markrian
mentioned in issue gitlab-org/quality/triage-reports#1918 (closed)
added 43 commits
Toggle commit listmentioned in issue create-stage#12789 (closed)
- Resolved by Mark Florian
- Resolved by Mark Florian
- Resolved by Paul Slaughter
- Resolved by Paul Slaughter
- Resolved by Mark Florian
- Resolved by Paul Slaughter
- Resolved by Mark Florian
mentioned in issue #320781 (closed)
- Resolved by Mark Florian
Thanks @pslaughter! This is looking excellent. I've left various comments, but basically I think they're all non-blocking. Still, I'd like to hear your thoughts before merging.
unassigned @markrian
mentioned in issue #320883
added 202 commits
Toggle commit listThanks again so much @markrian! I made a few updates and responses based on your comments. Back to you!
Edited by Paul Slaughterassigned to @markrian
mentioned in merge request !53576 (merged)
Thanks @pslaughter! Can't wait for this to merge
enabled an automatic merge when the pipeline for 18fab372 succeeds
mentioned in commit 10f905d8
Thanks again for reviewing and collaborating on this @markrian!
added workflowstaging label
added workflowcanary label and removed workflowstaging label
added workflowproduction label and removed workflowcanary label
added releasedcandidate label
mentioned in merge request !55660 (merged)
mentioned in merge request !65570 (merged)
added typemaintenance label and removed tooling (archive) label