banisterious_obsidian-chart.../vitest.config.ts
John Banister 3a3e2458c0 chore(timers): Sweep remaining bare timer calls to activeWindow (Phase 2)
Blanket migration of every remaining setTimeout / setInterval /
clearTimeout / clearInterval call across src/ and main.ts to the
activeWindow.* form. Closes the rest of the 152-warning
prefer-active-window-timers backlog from the 0.2.9 ESLint upgrade.

Vitest gets a new tests/setup.ts that points activeWindow at
globalThis so source code that runs under both Obsidian and the
unit-test runtime resolves to the host's setTimeout in tests.
2026-05-12 09:03:00 -07:00

23 lines
554 B
TypeScript

import { defineConfig } from 'vitest/config';
import path from 'node:path';
export default defineConfig({
test: {
include: ['tests/**/*.test.ts'],
setupFiles: ['tests/setup.ts'],
environment: 'node',
globals: false,
coverage: {
provider: 'v8',
reporter: ['text', 'html'],
include: ['src/**/*.ts'],
exclude: ['src/**/*.test.ts', 'src/**/types.ts']
}
},
resolve: {
alias: {
// Intercept `import { ... } from 'obsidian'` in tests and route to mock.
obsidian: path.resolve(__dirname, 'tests/mocks/obsidian.ts')
}
}
});