mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 09:09:36 +02:00
* [monorepo] move retries from the outside to the per-test level * [web] increase hookTimeout in CI * [monorepo] consolidate test retries - do not retry unit tests - only retry in ci, optionally locally with "RETRIES=3 make test..." - add retries for web Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com> --------- Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com> GitOrigin-RevId: 86e45edcfb087d18e0e957ad6df9a6105dcd5770
78 lines
2.0 KiB
JavaScript
78 lines
2.0 KiB
JavaScript
const { defineConfig } = require('vitest/config')
|
|
|
|
const COVERAGE_ENABLED = process.env.COVERAGE_UNIT_TESTS === 'true'
|
|
|
|
let reporterOptions = {}
|
|
if (process.env.CI && process.env.JUNIT_ROOT_SUITE_NAME) {
|
|
reporterOptions = {
|
|
maxWorkers: '50%',
|
|
reporters: [
|
|
'default',
|
|
[
|
|
'junit',
|
|
{
|
|
classnameTemplate: `${process.env.JUNIT_ROOT_SUITE_NAME}.{filename}`,
|
|
},
|
|
],
|
|
],
|
|
outputFile: 'data/reports/junit-vitest.xml',
|
|
}
|
|
}
|
|
|
|
module.exports = defineConfig({
|
|
test: {
|
|
setupFiles: ['./test/unit/bootstrap.mjs'],
|
|
globals: true,
|
|
isolate: false,
|
|
passWithNoTests: true, // in case there are no tests from one project or other in a module
|
|
projects: [
|
|
{
|
|
extends: true,
|
|
test: {
|
|
name: 'Parallel',
|
|
include: [
|
|
'modules/*/test/unit/**/*.test.mjs',
|
|
'test/unit/src/**/*.test.mjs',
|
|
],
|
|
sequence: {
|
|
groupOrder: 2,
|
|
},
|
|
exclude: ['**/*.sequential.test.mjs'],
|
|
fileParallelism: true,
|
|
},
|
|
},
|
|
{
|
|
extends: true,
|
|
test: {
|
|
name: 'Sequential',
|
|
sequence: {
|
|
groupOrder: 1,
|
|
},
|
|
include: [
|
|
'modules/*/test/unit/**/*.sequential.test.mjs',
|
|
'test/unit/src/**/*.sequential.test.mjs',
|
|
],
|
|
fileParallelism: false,
|
|
},
|
|
},
|
|
],
|
|
...reporterOptions,
|
|
hookTimeout: process.env.CI ? 20_000 : 10_000,
|
|
coverage: {
|
|
enabled: COVERAGE_ENABLED,
|
|
// Add 'sequential' / 'parallel' to the folder
|
|
reportsDirectory: `data/coverage/esm-unit-${(process.env.JUNIT_ROOT_SUITE_NAME || 'all').split(' ').pop()}`,
|
|
include: [
|
|
'app.mjs',
|
|
'app/**/*.{js,mjs}',
|
|
'modules/*/index.mjs',
|
|
'modules/*/app/src/**/*.{js,mjs}',
|
|
],
|
|
exclude: ['app/src/Features/Metadata/packageMapping.mjs'],
|
|
provider: 'istanbul',
|
|
reporters: ['console-details', 'clover'],
|
|
all: true,
|
|
},
|
|
},
|
|
})
|