|
1 | 1 | // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license. |
2 | 2 |
|
3 | | -import { defineConfig } from 'vitest/config'; |
| 3 | +import { configDefaults, defineConfig } from 'vitest/config'; |
| 4 | +import { readFileSync } from 'node:fs'; |
4 | 5 | import path from 'path'; |
5 | 6 |
|
| 7 | +// #16466 -- two vitest projects, two turbo tasks. `repo` owns the tests that read |
| 8 | +// outside this package (the list is vitest.repo-tests.json, which |
| 9 | +// check:cross-package-test-inputs holds equal to its own scan); `local` owns |
| 10 | +// every other test file. turbo hashes the wide `$TURBO_ROOT$` inputs on |
| 11 | +// `test:repo` only, so `test` stays cacheable across changes elsewhere in the |
| 12 | +// repo. `extends: true` keeps the root options (aliases included) on both. |
| 13 | +const REPO_TESTS: string[] = JSON.parse(readFileSync(path.join(__dirname, 'vitest.repo-tests.json'), 'utf8')); |
| 14 | + |
6 | 15 | export default defineConfig({ |
7 | 16 | test: { |
| 17 | + // Each project re-declares the root block's test options: a ROOT-level |
| 18 | + // value is inert for a project run (measured on vitest 4.1.10, see |
| 19 | + // check-registry-log-declared / check-console-intercept-disarm). |
| 20 | + projects: [ |
| 21 | + { |
| 22 | + extends: true, |
| 23 | + test: { |
| 24 | + name: 'local', |
| 25 | + include: configDefaults.include, |
| 26 | + exclude: [...configDefaults.exclude, ...REPO_TESTS], |
| 27 | + globals: true, environment: 'node', |
| 28 | + // #13517: quiet the registry's per-item registration chatter — the |
| 29 | + // engine's own `OS_REGISTRY_LOG` seam, not a change to its shipped |
| 30 | + // default. Enforced by scripts/check-registry-log-declared.mjs. |
| 31 | + env: { OS_REGISTRY_LOG: 'warn' }, |
| 32 | + // A late console.* must not redden a green suite (#10374); see the root |
| 33 | + // block. A ROOT-level value is inert for a project run, so it is |
| 34 | + // declared here as well (scripts/check-console-intercept-disarm.mjs). |
| 35 | + disableConsoleIntercept: true, |
| 36 | + }, |
| 37 | + }, |
| 38 | + { |
| 39 | + extends: true, |
| 40 | + test: { |
| 41 | + name: 'repo', |
| 42 | + include: REPO_TESTS, |
| 43 | + globals: true, environment: 'node', |
| 44 | + // #13517: quiet the registry's per-item registration chatter — the |
| 45 | + // engine's own `OS_REGISTRY_LOG` seam, not a change to its shipped |
| 46 | + // default. Enforced by scripts/check-registry-log-declared.mjs. |
| 47 | + env: { OS_REGISTRY_LOG: 'warn' }, |
| 48 | + // A late console.* must not redden a green suite (#10374); see the root |
| 49 | + // block. A ROOT-level value is inert for a project run, so it is |
| 50 | + // declared here as well (scripts/check-console-intercept-disarm.mjs). |
| 51 | + disableConsoleIntercept: true, |
| 52 | + }, |
| 53 | + }, |
| 54 | + ], |
8 | 55 | // A late console.* must not redden a green suite (#10374): vitest's worker |
9 | 56 | // forwards console output over RPC and discards the promise, and a write |
10 | 57 | // landing after teardown's rpcDone() snapshot is rejected into an unhandled |
|
0 commit comments