feat: Set up JavaScript testing framework (Vitest + Playwright)
- Created package.json with Vitest and Playwright dependencies - Configured vitest.config.js with happy-dom environment - Configured playwright.config.js with Chromium browser - Created test directory structure (tests/frontend/unit and e2e) - Added setup.test.js with 10 Vitest validation tests - Added setup.spec.js with 6 Playwright E2E validation tests - Created FRONTEND_SETUP.md with Node.js installation guide - Updated instructions.md marking task complete Note: Requires Node.js installation before running tests
This commit is contained in:
46
vitest.config.js
Normal file
46
vitest.config.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import path from 'path';
|
||||
import { defineConfig } from 'vitest/config';
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
// Use happy-dom for faster DOM testing
|
||||
environment: 'happy-dom',
|
||||
|
||||
// Include test files
|
||||
include: ['tests/frontend/unit/**/*.{test,spec}.{js,mjs,cjs}'],
|
||||
|
||||
// Global test utilities
|
||||
globals: true,
|
||||
|
||||
// Coverage configuration
|
||||
coverage: {
|
||||
provider: 'v8',
|
||||
reporter: ['text', 'html', 'json'],
|
||||
reportsDirectory: './htmlcov_frontend',
|
||||
include: ['src/server/web/static/js/**/*.js'],
|
||||
exclude: [
|
||||
'node_modules/',
|
||||
'tests/',
|
||||
'**/*.test.js',
|
||||
'**/*.spec.js'
|
||||
],
|
||||
all: true,
|
||||
lines: 80,
|
||||
functions: 80,
|
||||
branches: 80,
|
||||
statements: 80
|
||||
},
|
||||
|
||||
// Test timeout (30 seconds)
|
||||
testTimeout: 30000,
|
||||
|
||||
// Hook timeout (10 seconds)
|
||||
hookTimeout: 10000
|
||||
},
|
||||
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, './src/server/web/static/js')
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user