Files
Portfolio/vitest.config.ts
T
damjan_savicandClaude Sonnet 4.5 aaaa60f5db auto-claude: subtask-2-1 - Create tests for cache.ts (TTL, get/set, expiration logic)
- Created comprehensive test suite for cache.ts covering:
  - set() and get() operations with various data types
  - TTL expiration logic (default, custom, and edge cases)
  - has() method for checking key existence
  - delete() method for removing individual keys
  - clear() method for removing all keys
  - Expiration boundary testing
  - Different TTL values for different items
  - TTL reset when items are overwritten
- Fixed vitest.config.ts to include src/utils/** tests
- Fixed tsconfig.json to include src/utils/** files
- Used vi.useFakeTimers() for deterministic time-based testing
- All tests properly isolated with beforeEach/afterEach hooks

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-25 06:38:18 +01:00

52 lines
1.1 KiB
TypeScript

import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
export default defineConfig({
plugins: [
react({
babel: {
babelrc: false,
configFile: false,
}
})
],
test: {
globals: true,
environment: 'jsdom',
setupFiles: [],
include: ['**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
exclude: [
'**/node_modules/**',
'**/dist/**',
'**/.next/**',
'**/coverage/**',
'**/*.bak/**',
'**/src/components-vite/**',
'**/src/pages-vite/**',
'**/src/hooks/**',
'**/src/services/**'
],
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: [
'node_modules/',
'.next/',
'coverage/',
'**/*.config.{js,ts}',
'**/*.bak',
'src/components-vite/**',
'src/pages-vite/**',
'src/hooks/**',
'src/services/**'
]
}
},
resolve: {
alias: {
'@': resolve(__dirname, './src')
}
}
});