test: migrate from Jest to Vitest (Phase 1 complete)

- Remove Jest and all related packages
- Install Vitest with coverage support
- Create vitest.config.ts with path aliases
- Set up global test configuration
- Migrate all 6 test files to Vitest syntax
- Update TypeScript configuration for better Vitest support
- Create separate tsconfig.build.json for clean builds
- Fix all import/module issues in tests
- All 68 tests passing successfully
- Current coverage baseline: 2.45%

Phase 1 of testing suite improvement complete.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-07-28 13:05:38 +02:00
parent d44ec49814
commit aa3b2a8460
18 changed files with 2565 additions and 365 deletions

View File

@@ -7,7 +7,7 @@
"n8n-mcp": "./dist/mcp/index.js"
},
"scripts": {
"build": "tsc",
"build": "tsc -p tsconfig.build.json",
"rebuild": "node dist/scripts/rebuild.js",
"rebuild:optimized": "node dist/scripts/rebuild-optimized.js",
"validate": "node dist/scripts/validate.js",
@@ -19,7 +19,14 @@
"dev": "npm run build && npm run rebuild && npm run validate",
"dev:http": "MCP_MODE=http nodemon --watch src --ext ts --exec 'npm run build && npm run start:http'",
"test:single-session": "./scripts/test-single-session.sh",
"test": "jest",
"test": "vitest",
"test:ui": "vitest --ui",
"test:run": "vitest run",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest watch",
"test:unit": "vitest run tests/unit",
"test:integration": "vitest run tests/integration",
"test:e2e": "vitest run tests/e2e",
"lint": "tsc --noEmit",
"typecheck": "tsc --noEmit",
"update:n8n": "node scripts/update-n8n-deps.js",
@@ -83,21 +90,24 @@
"package.runtime.json"
],
"devDependencies": {
"@faker-js/faker": "^9.9.0",
"@testing-library/jest-dom": "^6.6.4",
"@types/express": "^5.0.3",
"@types/jest": "^29.5.14",
"@types/node": "^22.15.30",
"@types/ws": "^8.18.1",
"jest": "^29.7.0",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/ui": "^3.2.4",
"fishery": "^2.3.1",
"msw": "^2.10.4",
"nodemon": "^3.1.10",
"ts-jest": "^29.3.4",
"ts-node": "^10.9.2",
"typescript": "^5.8.3"
"typescript": "^5.8.3",
"vitest": "^3.2.4"
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.13.2",
"@n8n/n8n-nodes-langchain": "^1.102.1",
"axios": "^1.10.0",
"better-sqlite3": "^11.10.0",
"dotenv": "^16.5.0",
"express": "^5.1.0",
"n8n": "^1.103.2",