Add comprehensive test framework with vitest and TDD tests
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Has been cancelled
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Has been cancelled
- Set up vitest test framework with proper configuration - Added test scripts to package.json (test, test:watch, test:ui) - Created comprehensive SSRF validation tests (30 tests) - Tests for protocol validation (HTTP/HTTPS only) - Private IP blocking (127.x, 10.x, 172.16-31.x, 192.168.x, 169.254.x) - Kubernetes service DNS blocking (.svc, .cluster.local, etc.) - URL length validation (max 2048 chars) - DNS resolution error handling - Edge cases with ports, query params, userinfo - Created cache service tests (19 tests) - Cache hit/miss operations - Deterministic key generation - TTL expiry behavior - Size limits and LRU eviction - Cache bypass logic - Statistics tracking - Created integration test suite (marked as skip for CI) - Health endpoint tests - Playground endpoint tests with rate limiting - Authentication tests for screenshot endpoints - CORS header validation - Error handling and security headers - All unit tests pass (49 total tests) - Following strict Red/Green TDD methodology
This commit is contained in:
parent
b07b9cfd25
commit
cda259a3c6
6 changed files with 2214 additions and 3 deletions
21
vitest.config.ts
Normal file
21
vitest.config.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import { defineConfig } from 'vitest/config'
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
globals: true,
|
||||
environment: 'node',
|
||||
include: ['src/**/*.test.ts'],
|
||||
coverage: {
|
||||
provider: 'v8',
|
||||
reporter: ['text', 'html'],
|
||||
exclude: [
|
||||
'node_modules/',
|
||||
'dist/',
|
||||
'**/*.d.ts',
|
||||
'**/*.config.*',
|
||||
]
|
||||
},
|
||||
testTimeout: 10000,
|
||||
hookTimeout: 10000
|
||||
},
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue