- Add test result artifacts storage with multiple formats (JUnit, JSON, HTML) - Configure GitHub Actions to upload and preserve test outputs - Add PR comment integration with test summaries - Create benchmark comparison workflow for PR performance tracking - Add detailed test report generation scripts - Configure artifact retention policies (30 days for tests, 90 for combined) - Set up test metadata collection for better debugging This completes all remaining test infrastructure tasks and provides comprehensive visibility into test results across CI/CD pipeline.
74 lines
1.9 KiB
TypeScript
74 lines
1.9 KiB
TypeScript
import { defineConfig } from 'vitest/config';
|
|
import path from 'path';
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
globals: true,
|
|
environment: 'node',
|
|
setupFiles: ['./tests/setup/global-setup.ts'],
|
|
// Load environment variables from .env.test
|
|
env: {
|
|
NODE_ENV: 'test'
|
|
},
|
|
// Test execution settings
|
|
pool: 'threads',
|
|
poolOptions: {
|
|
threads: {
|
|
singleThread: process.env.TEST_PARALLEL !== 'true',
|
|
maxThreads: parseInt(process.env.TEST_MAX_WORKERS || '4', 10),
|
|
minThreads: 1
|
|
}
|
|
},
|
|
// Retry configuration
|
|
retry: parseInt(process.env.TEST_RETRY_ATTEMPTS || '2', 10),
|
|
// Test reporter
|
|
reporters: process.env.CI ? ['default', 'json', 'junit', 'html'] : ['default'],
|
|
outputFile: {
|
|
json: './test-results/results.json',
|
|
junit: './test-results/junit.xml',
|
|
html: './test-results/html/index.html'
|
|
},
|
|
coverage: {
|
|
provider: 'v8',
|
|
enabled: process.env.FEATURE_TEST_COVERAGE !== 'false',
|
|
reporter: (process.env.COVERAGE_REPORTER || 'lcov,html,text-summary').split(','),
|
|
reportsDirectory: process.env.COVERAGE_DIR || './coverage',
|
|
exclude: [
|
|
'node_modules/',
|
|
'tests/',
|
|
'**/*.d.ts',
|
|
'**/*.test.ts',
|
|
'**/*.spec.ts',
|
|
'scripts/',
|
|
'dist/',
|
|
'**/test-*.ts',
|
|
'**/mock-*.ts',
|
|
'**/__mocks__/**'
|
|
],
|
|
thresholds: {
|
|
lines: 80,
|
|
functions: 80,
|
|
branches: 75,
|
|
statements: 80
|
|
}
|
|
},
|
|
// Test isolation
|
|
isolate: true,
|
|
// File watch settings
|
|
watchExclude: ['**/node_modules/**', '**/dist/**', '**/.git/**']
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
'@tests': path.resolve(__dirname, './tests')
|
|
}
|
|
},
|
|
// TypeScript configuration
|
|
esbuild: {
|
|
target: 'node18'
|
|
},
|
|
// Define global constants
|
|
define: {
|
|
'process.env.TEST_ENVIRONMENT': JSON.stringify('true')
|
|
}
|
|
}); |