Migrate back from Jest
Created by: felixfbecker
Every week I see problems caused by Jest. A non-exhaustive list:
- Jest keeps running the tests even if a beforeAll hook failed, which then produce all the noisy test failure logs, screenshots etc (e.g. https://github.com/sourcegraph/sourcegraph/issues/5721#issuecomment-538079538)
- Jest buffers console messages and prints them all at the top, instead of in between the logs for the test descriptions, which makes browser console logs and screenshots hard to tie to a test (e.g. https://github.com/sourcegraph/sourcegraph/issues/5722#issuecomment-535956400)
- Debugging doesn't work (doesn't show the right line/file where it's stopped in)
- Jest doesn't support
module
in package.json, which monaco uses https://github.com/sourcegraph/sourcegraph/pull/7669/files#diff-66d3521f5e9f81934077fdd6653d0901R29
I believe it might be better to migrate back to mocha (or a differrent test runner that doesn't have these problems).
Iirc the reasons to switch to Jest was mostly that there was more things that "just work" out of the box and docs on how to test React components with snapshot tests. However, it seems many of these things actually don't work correctly, and then you are faced with less flexibility to fix them. With mocha, these would take some effort to setup because they don't work out of the box, but would all be possible because mocha only concerns itself with running tests and everything else can be setup on top of it.