mirror of
https://github.com/n8n-io/n8n.git
synced 2026-06-03 02:07:06 +02:00
41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import { defineConfig } from 'vitest/config';
|
|
import type { InlineConfig } from 'vitest/node';
|
|
|
|
export const createVitestConfig = (options: InlineConfig = {}) => {
|
|
const vitestConfig = defineConfig({
|
|
test: {
|
|
silent: true,
|
|
globals: true,
|
|
environment: 'jsdom',
|
|
setupFiles: ['./src/__tests__/setup.ts'],
|
|
reporters: process.env.CI === 'true' ? ['default', 'junit'] : ['default'],
|
|
outputFile: { junit: './junit.xml' },
|
|
coverage: {
|
|
enabled: false,
|
|
all: false,
|
|
provider: 'v8',
|
|
reporter: ['text-summary', 'lcov', 'html-spa'],
|
|
},
|
|
css: {
|
|
modules: {
|
|
classNameStrategy: 'non-scoped',
|
|
},
|
|
},
|
|
...options,
|
|
},
|
|
});
|
|
|
|
if (process.env.COVERAGE_ENABLED === 'true' && vitestConfig.test?.coverage) {
|
|
const { coverage } = vitestConfig.test;
|
|
coverage.enabled = true;
|
|
if (process.env.CI === 'true' && coverage.provider === 'v8') {
|
|
coverage.all = true;
|
|
coverage.reporter = ['cobertura'];
|
|
}
|
|
}
|
|
|
|
return vitestConfig;
|
|
};
|
|
|
|
export const vitestConfig = createVitestConfig();
|