Files
n8n-mcp/vitest.config.ts
czlonkowski b5210e5963 feat: add comprehensive performance benchmark tracking system
- Create benchmark test suites for critical operations:
  - Node loading performance
  - Database query performance
  - Search operations performance
  - Validation performance
  - MCP tool execution performance

- Add GitHub Actions workflow for benchmark tracking:
  - Runs on push to main and PRs
  - Uses github-action-benchmark for historical tracking
  - Comments on PRs with performance results
  - Alerts on >10% performance regressions
  - Stores results in GitHub Pages

- Create benchmark infrastructure:
  - Custom Vitest benchmark configuration
  - JSON reporter for CI results
  - Result formatter for github-action-benchmark
  - Performance threshold documentation

- Add supporting utilities:
  - SQLiteStorageService for benchmark database setup
  - MCPEngine wrapper for testing MCP tools
  - Test factories for generating benchmark data
  - Enhanced NodeRepository with benchmark methods

- Document benchmark system:
  - Comprehensive benchmark guide in docs/BENCHMARKS.md
  - Performance thresholds in .github/BENCHMARK_THRESHOLDS.md
  - README for benchmarks directory
  - Integration with existing test suite

The benchmark system will help monitor performance over time and catch regressions before they reach production.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-28 22:45:09 +02:00

73 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'] : ['default'],
outputFile: {
json: './test-results/results.json',
junit: './test-results/junit.xml'
},
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')
}
});