mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 15:51:43 +00:00
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.
37 lines
1020 B
JavaScript
37 lines
1020 B
JavaScript
// @ts-check
|
|
|
|
/** @type {import('@babel/core').ConfigFunction} */
|
|
module.exports = api => {
|
|
const isTest = api.env('test')
|
|
api.cache.forever()
|
|
|
|
/**
|
|
* Do no use babel-preset-env for mocha tests transpilation in Bazel.
|
|
* This is temporary workaround to allow us to use modern language featurs in `drive.page.evaluate` calls.
|
|
*/
|
|
const disablePresetEnv = Boolean(process.env.DISABLE_PRESET_ENV && JSON.parse(process.env.DISABLE_PRESET_ENV))
|
|
|
|
return {
|
|
presets: [
|
|
...(disablePresetEnv
|
|
? []
|
|
: [
|
|
[
|
|
'@babel/preset-env',
|
|
{
|
|
// Node (used for testing) doesn't support modules, so compile to CommonJS for testing.
|
|
modules: process.env.BABEL_MODULE ?? (isTest ? 'commonjs' : false),
|
|
},
|
|
],
|
|
]),
|
|
['@babel/preset-typescript', { isTSX: true, allExtensions: true }],
|
|
[
|
|
'@babel/preset-react',
|
|
{
|
|
runtime: 'automatic',
|
|
},
|
|
],
|
|
],
|
|
}
|
|
}
|