1import { fileURLToPath } from 'node:url'; 2import { defineConfig } from 'vitest/config'; 3import bundleAudioWorkletPlugin from 'vite-plugin-bundle-audioworklet'; 4 5/// <reference types="vitest" /> 6export default defineConfig({ 7 plugins: [bundleAudioWorkletPlugin()], 8 // jevstrudel: JSX as the site builds it (Astro's React, the automatic 9 // runtime), so a test can render a component without importing React 10 esbuild: { jsx: 'automatic' }, 11 resolve: { 12 // jevstrudel: the Worker's tests run in Node, which has no 13 // `cloudflare:workers` (worker/test/cloudflare-workers.ts) 14 alias: { 'cloudflare:workers': fileURLToPath(new URL('./worker/test/cloudflare-workers.ts', import.meta.url)) }, 15 }, 16 test: { 17 reporters: 'verbose', 18 isolate: false, 19 silent: true, 20 exclude: [ 21 '**/node_modules/**', 22 '**/dist/**', 23 '**/cypress/**', 24 '**/.{idea,git,cache,output,temp}/**', 25 '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress}.config.*', 26 '**/shared.test.mjs', 27 // jevstrudel: direnv's flake-input copies and agent worktrees hold 28 // stale copies of the tree's tests 29 '**/.direnv/**', 30 '**/.claude/**', 31 ], 32 setupFiles: './vitest.setup.mjs', 33 // jevstrudel: transformed by Vite rather than loaded by Node, so the 34 // `cloudflare:workers` alias above applies inside it too 35 server: { deps: { inline: ['@cloudflare/workers-oauth-provider'] } }, 36 }, 37});