* reapply "switch from jest to vitest for faster, simpler tests (https://github.com/sourcegraph/sourcegraph/pull/57886)"
This was reverted in https://github.com/sourcegraph/sourcegraph/pull/58116 due to an issue with the browser tests.
* include fetch-mock
* fix flakiness
* rm mock that did not work in experimentalVmThreads
* fix
* timeout
* fixup
---------
Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com>
When running vitests concurrently the target //client/browser:test fails
Revert "switch from jest to vitest for faster, simpler tests (#57886)"
This reverts commit ae5325e432.
Replaces our usage of jest with vitest. Also removes the babel transpiler. This simplifies our test configuration by a lot, makes tests run 10% faster, and makes further modernizations to our build/test stuff possible (such as using vite for frontend builds).
This removes some of the junit exporting for Buildkite, and the vitest bazel defs don't really cleanly implement bazel testing guidelines (like sharding). But vitest is only used for unit tests (all integration/e2e/regression tests have always run in mocha), so none of them are very slow anyway.
## Codemods for vitest imports
fastmod -e js,ts,tsx @jest/globals vitest client/ dev/release/
fastmod -e js,ts,tsx 'jest\.(\w+)\(' 'vi.$1(' client/ dev/release/
fastmod -e js,ts,tsx 'jest,' 'vi,' client/ dev/release/
fastmod -e js,ts,tsx 'jest }' 'vi }' client/ dev/release/
git diff --diff-filter=M --name-only | xargs pnpm exec prettier --write
Actually, webpack_bundle doesn't have JS_BINARY__TARGET set since it is
a custom build rule.... To handle all the cases I think we have to check
for both. 😞
`BAZEL_BINDIR` is set for build targets only while `JS_BINARY__TARGET`
should be set for all js_binary & js_test targets for bazel build, test
& run contexts.
Webpack bundles compile but need further testing. Jest + mocha tests
compile but are marked as `manual` until further work is done to get them
passing. The four jest tests are green and enabled now, though.
## Test plan
`bazel build //client/...` and `bazel test //client/...`
* update custom mocha reporter to be more robust
- ensure all files reference by mocha and mocha reporter are relative to
repo root
- remove `--exit` from `yarn run test:regression`. The same
functionality is now done by the customMochaSpecReporter with
`process.exit(1)`
- some quality of life things in the qa test runner script
* Update client/shared/dev/customMochaSpecReporter.js
Co-authored-by: Valery Bugakov <skymk1@gmail.com>
* Update client/shared/dev/customMochaSpecReporter.js
Co-authored-by: Valery Bugakov <skymk1@gmail.com>
* prettier things
* use filenames in annotation
Co-authored-by: Valery Bugakov <skymk1@gmail.com>
* initial commit of test reporter
* better use of annotated cmd
Co-authored-by: Valery Bugakov <skymk1@gmail.com>
* review comments and add additional comments describing approach
* rename reporter.js to something more descriptive
* restore files changed for debugging
* make eslint and prettier happy
Co-authored-by: Valery Bugakov <skymk1@gmail.com>