test(vitest): allow tests outside frontend/ + discover velxio-prod pro overlay tests

Two related changes for the v0.4.0 desktop-agent rollout:

- include glob now also matches `../../pro/frontend/src/pro/**/__tests__/`
  so the agent-overlay tests in velxio-prod are discovered when this
  config is used from a velxio-prod checkout. On pure-OSS clones the
  glob has nothing to match - harmless.

- server.fs.allow extended to `..` and `../..` so Vite's filesystem
  sandbox doesn't reject the cross-project test paths with
  "Cannot find module '/@fs/...'".

No behavior change for OSS-only contributors. velxio-prod gets the
agent's `desktopAuth` unit tests picked up automatically by
`npx vitest run` in this directory.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
David Montero Crespo 2026-05-26 14:53:04 -03:00
parent 3bd6f144f2
commit d347cac51e
1 changed files with 14 additions and 1 deletions

View File

@ -17,10 +17,23 @@ import { defineConfig } from 'vitest/config';
* and the test files themselves.
*/
export default defineConfig({
// Allow vitest to import test files / sources from outside this
// project root - specifically `../../pro/frontend/src/pro/...` for
// velxio-prod overlay tests. Without this, Vite's fs sandbox blocks
// the read with "Cannot find module '/@fs/...'".
server: { fs: { allow: ['..', '../..'] } },
test: {
globals: true,
environment: 'node',
include: ['src/__tests__/**/*.test.ts', 'src/**/__tests__/**/*.test.ts'],
include: [
'src/__tests__/**/*.test.ts',
'src/**/__tests__/**/*.test.ts',
// velxio-prod pro overlay tests (when run from a velxio-prod
// checkout — these are the source-of-truth pro tests, not the
// stale copies at src/pro/). Harmless on pure-OSS clones
// because the glob has nothing to match there.
'../../pro/frontend/src/pro/**/__tests__/**/*.test.ts',
],
testTimeout: 30_000,
hookTimeout: 30_000,
// Vitest 4 removed `test.poolOptions` — config moved to top-level