Files
overleaf-cep/services/web/vitest.config.js
Andrew Rumble c7c15b2066 Split tests into sequential and parallel projects
Sequential tests need to be run without parallelism because they rely on
a database fixture that can have side effects.

GitOrigin-RevId: b614cbe4dbaf2319e681d5607a0a64cbbed8c021
2025-11-06 09:06:06 +00:00

51 lines
1.1 KiB
JavaScript

const { defineConfig } = require('vitest/config')
let reporterOptions = {}
if (process.env.CI && process.env.MOCHA_ROOT_SUITE_NAME) {
reporterOptions = {
reporters: [
'default',
[
'junit',
{
classnameTemplate: `${process.env.MOCHA_ROOT_SUITE_NAME}.{filename}`,
},
],
],
outputFile: 'data/reports/junit-vitest.xml',
}
}
module.exports = defineConfig({
test: {
setupFiles: ['./test/unit/vitest_bootstrap.mjs'],
globals: true,
isolate: false,
projects: [
{
extends: true,
test: {
name: 'Parallel',
include: [
'modules/*/test/unit/**/*.test.mjs',
'test/unit/src/**/*.test.mjs',
],
exclude: ['**/*.sequential.test.mjs'],
fileParallelism: true,
},
},
{
extends: true,
test: {
name: 'Sequential',
include: [
'modules/*/test/unit/**/*.sequential.test.mjs',
'test/unit/src/**/*.sequential.test.mjs',
],
fileParallelism: false,
},
},
],
...reporterOptions,
},
})