mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-03-28 05:03:07 +00:00
Remove duplicate, low-value, and fragmented test files while preserving all meaningful coverage. Enable parallel test execution and remove the entire benchmark infrastructure. Key changes: - Consolidate workflow-validator tests (13 files -> 3) - Consolidate config-validator tests (9 files -> 3) - Consolidate telemetry tests (11 files -> 6) - Merge AI validator tests (2 files -> 1) - Remove example/demo test files, mock-testing files, and already-skipped tests - Remove benchmark infrastructure (10 files, CI workflow, 4 npm scripts) - Enable parallel test execution (remove singleThread: true) - Remove retry:2 that was masking flaky tests - Slim CI publish-results job Results: 224 -> 191 test files, 4690 -> 4303 tests, 121K -> 106K lines Local runtime: 319s -> 27s (11.9x speedup) Conceived by Romuald Członkowski - www.aiadvisors.pl/en Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
76 lines
2.1 KiB
TypeScript
76 lines
2.1 KiB
TypeScript
import { defineConfig } from 'vitest/config';
|
|
import path from 'path';
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
globals: true,
|
|
environment: 'node',
|
|
// Only include global-setup.ts, remove msw-setup.ts from global setup
|
|
setupFiles: ['./tests/setup/global-setup.ts'],
|
|
// Load environment variables from .env.test
|
|
env: {
|
|
NODE_ENV: 'test'
|
|
},
|
|
// Test execution settings
|
|
pool: 'threads',
|
|
poolOptions: {
|
|
threads: {
|
|
maxThreads: parseInt(process.env.TEST_MAX_WORKERS || '4', 10),
|
|
minThreads: 1
|
|
}
|
|
},
|
|
// No retries - flaky tests should be fixed, not masked
|
|
retry: 0,
|
|
// Test reporter - reduce reporters in CI to prevent hanging
|
|
reporters: process.env.CI ? ['default', 'junit'] : ['default'],
|
|
outputFile: {
|
|
junit: './test-results/junit.xml'
|
|
},
|
|
coverage: {
|
|
provider: 'v8',
|
|
enabled: process.env.FEATURE_TEST_COVERAGE !== 'false',
|
|
reporter: process.env.CI ? ['lcov', 'text-summary'] : (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: 75,
|
|
functions: 75,
|
|
branches: 70,
|
|
statements: 75
|
|
},
|
|
// Add coverage-specific settings to prevent hanging
|
|
all: false, // Don't collect coverage for untested files
|
|
skipFull: true // Skip files with 100% coverage
|
|
},
|
|
// Test isolation
|
|
isolate: true,
|
|
// Force exit after tests complete in CI to prevent hanging
|
|
forceRerunTriggers: ['**/tests/**/*.ts'],
|
|
teardownTimeout: 1000
|
|
},
|
|
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')
|
|
}
|
|
}); |