import { defineConfig } from 'vitest/config';
import { fileURLToPath } from 'url';
import { dirname, resolve } from 'path';

const rootDir = dirname(fileURLToPath(import.meta.url));

export default defineConfig({
  test: {
    globals: false,
    environment: 'node',
    coverage: {
      provider: 'v8',
      include: ['src/helpers/**/*.ts'],
      reporter: ['text', 'lcov'],
      thresholds: {
        lines: 95,
        statements: 95,
        functions: 95,
        branches: 80,
      },
    },
  },
  resolve: {
    alias: {
      'ponder:schema': resolve(rootDir, 'tests/__mocks__/ponder-schema.ts'),
      'ponder:registry': resolve(rootDir, 'tests/__mocks__/ponder-registry.ts'),
      'kraiken-lib/version': resolve(rootDir, '../../kraiken-lib/src/version.ts'),
    },
  },
});
