Skip to content

Developer experience - `yarn test` likely to fail locally

When checking out the project for the first time, it's plausible that a developer would run yarn test. This is likely to fail due to snapshot tests being platform dependent. Worse - the command line output suggests updating the snapshots:

Screenshot_2019-02-20_at_11.43.26

Unless they've already contributed to the project, they're unlikely to know that these tests will pass on a CI build but fail locally. They may also not know that it's possible to pass the tests locally using gitlab-runner.

Fix:

  • Simply adding a section about tests to the README.md should be enough of a signpost.
  • Even better (in my opinion) would be to separate the snapshot tests into a separate npm script, so that yarn test passes by default. Add a test-ci script that runs both test and check-snapshots in CI.