-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathvitest.config.ts
More file actions
65 lines (63 loc) · 3.6 KB
/
Copy pathvitest.config.ts
File metadata and controls
65 lines (63 loc) · 3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
// #3071: without these aliases, vitest resolves workspace deps through their
// package.json `exports` — i.e. `dist/` — so whether this package's tests
// even LOAD depends on turbo build ordering and cache-restore integrity on
// the runner (the deterministic zero-output CI failure). Aliasing to `src/`
// (the same convention plugin-hono-server et al. already use) removes the
// dist dependency entirely.
import { defineConfig } from 'vitest/config';
import path from 'path';
export default defineConfig({
test: {
// A late console.* must not redden a green suite (#10374): vitest's worker
// forwards console output over RPC and discards the promise, and a write
// landing after teardown's rpcDone() snapshot is rejected into an unhandled
// error — a fully green run that exits 1. Disarming removes the mechanism.
// Mechanism + measured costs: examples/app-showcase/vitest.config.ts.
// Enforced repo-wide by scripts/check-console-intercept-disarm.mjs.
disableConsoleIntercept: true,
globals: true,
environment: 'node',
},
resolve: {
// Array form with ANCHORED patterns, deliberately — the same correction
// `service-knowledge` recorded, arriving here for the same reason. The
// object form matches by PREFIX, so the bare `@objectstack/spec` entry
// swallowed every subpath not spelled out above it: `@objectstack/spec/ui`
// resolved to `spec/src/index.ts/ui` and failed with `ENOTDIR`. That kept
// the namespace list a thing every new import had to extend by hand, and
// the failure landed on whoever added the import, naming a path nobody
// wrote — which is exactly how it surfaced for #5860's real-engine test
// (`@objectstack/objectql` reaches `@objectstack/spec/ui` transitively).
// One rule for all namespaces cannot go stale that way.
alias: [
{ find: /^@objectstack\/core$/, replacement: path.resolve(__dirname, '../../core/src/index.ts') },
// [#10101] The shared platform-row resolver's home — aliased to source
// so the suite's verdict is about the checkout, not metadata-core's
// dist build state (`pnpm check:test-source-alias`).
{ find: /^@objectstack\/metadata-core$/, replacement: path.resolve(__dirname, '../../metadata-core/src/index.ts') },
{
find: /^@objectstack\/platform-objects\/audit$/,
replacement: path.resolve(__dirname, '../../platform-objects/src/audit/index.ts'),
},
// [#12642] The i18n provenance seam. This package's translation barrel
// passes its committed `<locale>.source-hashes.generated.ts` companions
// through `withSourceFallback`, whose home is this subpath — so without
// the alias the suite's verdict would be about `platform-objects/dist`
// build state rather than the checkout (`pnpm check:test-source-alias`).
{
find: /^@objectstack\/platform-objects\/apps$/,
replacement: path.resolve(__dirname, '../../platform-objects/src/apps/index.ts'),
},
// Covers `data` / `system` / `kernel` / `api` / `contracts` / `ui` /
// `shared` and, [ADR-0105 D1], `security` reached transitively via
// `@objectstack/types` (tenancy posture).
{
find: /^@objectstack\/spec\/([a-z-]+)$/,
replacement: `${path.resolve(__dirname, '../../spec/src')}/$1/index.ts`,
},
{ find: /^@objectstack\/spec$/, replacement: path.resolve(__dirname, '../../spec/src/index.ts') },
{ find: /^@objectstack\/types$/, replacement: path.resolve(__dirname, '../../types/src/index.ts') },
],
},
});