Jest step sometimes doesn’t run tests
Description of the issue
Build sometimes fails as it attempts to deploy the lcov_report
generated when running jest but cannot find the file. Turns out the tests aren’t running at all to actually generate the file.
The testing step runs our yarn test:ci
script which runs jest --debug --verbose --ci
It starts off outputting the usual log stuff then just ends there without running a single test.
Oddly, this seems to be random and temperamental, and simply running a rebuild solves it for that build as it then runs the tests properly and passes fine. We can then go several builds and days before it happens again.
It doesn’t seem to matter what branch, how big the PR is, date & time, etc. Just seems to be random.
The steps used are fairly standard:
- activate-ssh-key
- git clone repo
- continue from repo
- cache-pull
- yarn install
- create .env files
- yarn lint (runs
eslint .
) - yarn typecheck (runs
tsc -p tsconfig.spec.json
) - Run tests - this is a script that runs the following
- set -o pipefail
- yarn test:ci (runs
jest --debug --verbose --ci
) <-- issue, doesn’t run any tests but outputs the pre-test log followed byDone in X seconds
- tee simple-test-report.txt
- Deploy the simple-test-report
- Deploy the full lcov_report <-- fails due to no lcov_report generated
- cache-push
- Message Slack
Reproducibility
- Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : YES
-
Does a rebuild without caches help? (You can remove the
Cache:Pull
andCache:Push
steps temporarily to not to use the cache, or you can delete all the caches on theSettings
tab of the app. : YES but probably just because of the rebuild - Does the issue happen sporadically, or every time? : SPORADICALLY
- When did the issue start? : Around 16th June 2020
Local reproduction
Running the yarn test:ci
jest script locally works as expected, tests are run and the coverage report is generated. Running that specific test script locally, mentioned above with the test report file, works fine too. As do all the other steps that can be run locally.
Running the bitrise pipeline locally via CLI also seems to work fine, though due to the random nature of this issue it might require many local runs before it appears.