debian-image-builder-frontend/vitest.config.ts
regexowl 28253c040e vitests: Set global retry
This sets retry globally to `3`, so we don't have to add it to the tests individually.

For the tests that are reliable this shouldn't have any effect, but it will trigger on tests that proved to be a bit flakey (like revisit tests).
2025-02-10 10:02:54 +01:00

49 lines
1.2 KiB
TypeScript

import path from 'path';
import react from '@vitejs/plugin-react';
const config = {
plugins: [react()],
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./src/test/setup.ts'],
coverage: {
provider: 'v8',
},
server: {
deps: {
inline: ['vitest-canvas-mock', '@patternfly', '@monaco-editor'],
},
},
testTimeout: 10000,
fileParallelism: false,
exclude: ['./pkg/lib/**', '**/node_modules/**', '**/dist/**'],
retry: 3,
},
reporters: ['default', 'junit'],
outputFile: {
junit: './coverage/junit.xml',
},
resolve: {
mainFields: ['module'],
alias: {
// we have to point vitest to the mocks for `cockpit` and `cockpit/fsinfo`
// by using aliases. This allows vitest to resolve these two packages
// and allows the tests to pass
cockpit: path.resolve(__dirname, 'src/test/mocks/cockpit'),
'cockpit/fsinfo': path.resolve(
__dirname,
'src/test/mocks/cockpit/fsinfo'
),
'os-release': path.resolve(__dirname, 'src/test/mocks/os-release'),
},
},
esbuild: {
loader: 'tsx',
include: /src\/.*\.[tj]sx?$/,
exclude: [],
},
};
export default config;