- 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>
52 lines
1.1 KiB
TypeScript
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')
|
|
}
|
|
}
|
|
});
|