mirror of
https://github.com/supabase/supabase.git
synced 2026-06-17 13:14:06 +08:00
The `Update JS Client Libraries Docs` workflow's "Refresh
reference-content snapshot" step fails because `npx vitest run --update
scripts/build-reference-content.test.ts` is treated as a filter, not a
restriction, under Vitest 4, so all docs tests
run. `CodeSample.test.ts` then fails with ENOENT on
`apps/docs/examples/_internal/fixtures/*` because the workflow bypasses
the `pretest` npm hook that runs `codegen:examples`.
This is a regression of #44943 (commit 28ef62cf31), reintroduced by
#46163 when the snapshot step was renamed and rewritten back to the
file-path form.
Fixes:
- Workflow: use `--dir scripts` so only the snapshot test runs.
- Tests: add a vitest globalSetup that mirrors `codegen:examples`, so
`npx vitest`, `pnpm test:local`, and IDE single-test runs no longer
depend on the `pretest` lifecycle hook being triggered first.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Chores**
* Updated test infrastructure configuration and initialization process
for improved test suite management.
* Refined test execution workflow to efficiently manage test discovery
and execution across project directories.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
20 lines
604 B
TypeScript
20 lines
604 B
TypeScript
import tsconfigPaths from 'vite-tsconfig-paths'
|
|
import { defineConfig } from 'vitest/config'
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
// Exclude examples from test discovery (does not affect tsconfig scanning)
|
|
exclude: ['examples/**/*', '**/node_modules/**'],
|
|
setupFiles: ['vitest.setup.ts'],
|
|
globalSetup: ['vitest.globalSetup.ts'],
|
|
},
|
|
// Restrict tsconfig-paths to only use this app's tsconfig
|
|
plugins: [
|
|
tsconfigPaths({
|
|
root: import.meta.dirname,
|
|
// Prevent scanning tsconfig files in subfolders like examples/**
|
|
projects: ['tsconfig.json'],
|
|
}),
|
|
],
|
|
})
|