Page MenuHomePhabricator

[Cashtab] Update snapshots without manual input
ClosedPublic

Authored by bytesofman on Jan 7 2022, 14:09.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCb0052632ac08: [Cashtab] Update snapshots without manual input
Summary

Related to T2088

Cashtab diffs are frequently pushed with un-updated snapshots causing avoidable teamcity errors.

This diff adds the -u flag to the jest npm test command, which auto-updates snapshots every time npm test is run (before, the user would have to wait for snapshot tests to fail, then push u).

Getting this automated will reduce admin burden and is a stepping stone toward including other cashtab linting in arc lint.

Test Plan
  1. Edit the file Send.js by changing some of the rendered text, e.g. by changing the text "Switch to multiple recipients" to something else
  2. Run npm test
  3. Note that new snapshots are created automatically and tests do not fail.
  4. Revert your original changes to Send.js
  5. Run npm test
  6. Note that new snapshots are created automatically and tests do not fail (and they are equivalent to the previous snapshots)

Diff Detail

Repository
rABC Bitcoin ABC
Branch
auto-update-snapshots
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 17830
Build 35486: Build Diffcashtab-tests
Build 35485: arc lint + arc unit

Event Timeline

Disable localization in jest to prevent locale dependency of unit tests

Disabling localization in node env var

Removing localization patch attempts, to be handled in separate diff

Add the -u flag for all instances of test (previously it was only added if !process.env.CI)

rebase to include locale update to formatDate

The @generated marks are removed in the process, the script that add them back needs to run each time the snapshots are updated. But this should be another diff.

This revision is now accepted and ready to land.Jan 13 2022, 08:22