Some checks failed
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
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();
|