Jest quits with exit code 1 even though all tests are passing. This happens only on GitHub Actions CI on Windows.
> jest
PASS src/some.test.js
##[error]Process completed with exit code 1.
Ubuntu and MacOS builds are working correctly. When I run the same test suite on my personal Windows PC it also works (tests are passing and %errorlevel% is 0).

I've notices this behaviour on Electron+TypeScript project so I thought that maybe there is something wrong with configuration, but then I've created simple repo to reproduce the problem without TypeScript and without any configuration and the issue still persists.
Run jest on GitHub Actions CI.
When all tests are passing jest should stop with exit code 0.
Repo: https://github.com/Deseteral/jest-gh-actions-issue
Logs of last failing build: https://github.com/Deseteral/jest-gh-actions-issue/commit/dc21dd4b95bbe88ef73163156f4cdac0a253b37d/checks?check_suite_id=402904990
envinfo on GitHub Actions CI with windows-latest OS:
System:
OS: Windows 10 10.0.17763
CPU: (2) x64 Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
Binaries:
Node: 12.14.1 - C:\hostedtoolcache\windows\node\12.14.1\x64\node.EXE
Yarn: 1.21.1 - C:\npm\prefix\yarn.CMD
npm: 6.13.4 - C:\hostedtoolcache\windows\node\12.14.1\x64\npm.CMD
npmPackages:
jest: ^24.9.0 => 24.9.0
This is very odd, and the first I've heard of it - surely somebody else has tried to use Jest on GH Actions CI? I've set it up myself here: https://github.com/jest-community/eslint-plugin-jest/runs/385531999. It's also missing the footer.
I have absolutely no idea how to debug this, maybe @ericsciple (or someone they can poke) could shed some light on this?
Hi there! I'm having the same issue. You can see an example here:
https://github.com/twilio-labs/sample-template-nodejs/pull/20/checks
I thought maybe the difference was running yarn instead of npm, so I created test branch with yarn, but that wasn't the case:
https://github.com/Deseteral/jest-gh-actions-issue/commit/555e00e47dcc93140d7040fa19647a39f2a99b41/checks?check_suite_id=405789769
Does it only fail on Windows when using the hosted runner, e.g. runs-on: windows-latest? Or does it also fail when you setup a self-hosted runner?
That may help narrow whether it's related to the VM image for the hosted Windows runners, or whether it's related to the actual runner itself (the program that runs the job locally on the machine and posts logs back to the service).
If it fails on self-hosted runner also, then try take the runner out of the picture and see if it fails from a plain command prompt on that same machine.
fwiw we're using jest on several repos (e.g. this one) and it's working on the hosted windows-latest runner
Got the same problem and maybe the following information helps.
The described problem occurs when using the runs-on option (so not using a self-hosted runners).
Github currently supports three versions: windows-latest, windows-2019 and windows-2016.
The only version jest successfully runs on (for me) is windows-2016. On the other two (or are they the same?) it crashes as described above.
thanks @Supereg that helps rule out the runner itself and points to the VM.
The repo actions/virtual-environments contains the scripts that build the VM image.
I would recommend file an issue in that repo, and request advice how to debug an issue only failing on windows-2019 (i.e. windows-latest) and not windows-2016. I am hopeful they may have some advice like how to setup the VM image locally for debugging. Or they may have other suggestions. @thejoebourneidentity @densto88 @stbeam fyi
Same problem here. I wrote native code so at first I thought my code had memory access issue.
https://github.com/netheril96/securefs/runs/524324735?check_suite_focus=true
@Deseteral and others, please open an issue for this over at actions/virtual-environments so the Actions team can help and look into why this might be happening. Thanks
@thejoebourneidentity thanks for suggestion, I just did that :)
It looks like the issue doesn't occur anymore. My two repos with windows builds now have passing tests.
Great to hear. Feel free to close issues and reach out to us again if you see it again!
Most helpful comment
Got the same problem and maybe the following information helps.
The described problem occurs when using the
runs-onoption (so not using a self-hosted runners).Github currently supports three versions:
windows-latest,windows-2019andwindows-2016.The only version jest successfully runs on (for me) is
windows-2016. On the other two (or are they the same?) it crashes as described above.