import { defineConfig } from 'vitest/config';

export default defineConfig({
  // Plan 01-11: declare `__MOKOSH_UAT__` as `false` for vitest's own
  // SOURCE-loading test runs. Vitest's load pipeline goes through Vite,
  // so `define` text-replaces the token in any source the test files
  // import — keeping the gated test-hook dynamic imports (in
  // src/background/index.ts + src/offscreen/recorder.ts) as static
  // dead branches under unit tests. Without this, vitest would throw
  // `ReferenceError: __MOKOSH_UAT__ is not defined` when loading those
  // sources, OR would activate the hooks and clobber the existing
  // vi.fn() chrome.* mocks the 83-test baseline relies on.
  // Reference: https://vite.dev/config/shared-options.html#define
  define: {
    __MOKOSH_UAT__: 'false',
  },
  test: {
    environment: 'node',
    include: ['tests/**/*.test.ts'],
    // Plan 01-11: exclude the Puppeteer harness from vitest's discovery.
    // tests/uat/harness.test.ts is a tsx-runnable Node script invoked
    // via `npm run test:uat`; running it under vitest would try to
    // launch a real Chrome inside the vitest worker (interactive UAT
    // does not belong in the unit-test pass). The .test.ts suffix is
    // retained for editor + naming-convention consistency with the
    // rest of the tests/ tree.
    exclude: ['node_modules/**', 'tests/uat/**'],
    reporters: 'dot',
    typecheck: {
      enabled: false,
    },
  },
});
