@ultimat3/cli 31.26.0 → 31.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +44 -36
- package/README.md +5 -4
- package/package.json +29 -29
- package/src/app-mcp.ts +17 -3
- package/src/cmd-cache-spec.ts +5 -2
- package/src/cmd-db-spec.ts +2 -3
- package/src/cmd-db.ts +0 -2
- package/src/cmd-deploy-verify-sample.ts +93 -0
- package/src/cmd-deploy-verify.ts +2 -41
- package/src/cmd-dev-spec.ts +15 -1
- package/src/cmd-dev.ts +31 -4
- package/src/cmd-doctor.ts +4 -1
- package/src/cmd-exercise-spec.ts +7 -1
- package/src/cmd-exercise.ts +22 -10
- package/src/cmd-generate.ts +2 -0
- package/src/cmd-jobs-spec.ts +3 -6
- package/src/cmd-jobs.ts +1 -7
- package/src/cmd-logs-spec.ts +2 -1
- package/src/cmd-logs.ts +9 -28
- package/src/cmd-planned.ts +11 -45
- package/src/cmd-profile-frames.ts +99 -0
- package/src/cmd-profile-spec.ts +24 -0
- package/src/cmd-profile.ts +164 -0
- package/src/cmd-status-sample.ts +57 -0
- package/src/cmd-status-spec.ts +30 -0
- package/src/cmd-status.ts +108 -0
- package/src/cmd-token-spec.ts +5 -2
- package/src/cmd-token.ts +7 -3
- package/src/coverage-island.ts +121 -0
- package/src/coverage-lcov.ts +49 -5
- package/src/coverage-remap.ts +146 -0
- package/src/db-replay-engine-prepared.ts +66 -0
- package/src/db-replay-engine-template.ts +156 -0
- package/src/db-replay-engine.ts +4 -0
- package/src/db-replay-scratch-reap.ts +54 -0
- package/src/deploy-verify-flags.ts +9 -2
- package/src/deploy-verify-grade.ts +10 -3
- package/src/dev-boot.ts +14 -1
- package/src/dev-dashboard-guard.ts +57 -10
- package/src/dev-host.ts +46 -0
- package/src/dev-tls-cache.ts +103 -0
- package/src/dev-tls-der.ts +69 -0
- package/src/dev-tls.ts +120 -0
- package/src/doctor-browser.ts +60 -0
- package/src/error-codes-verify.ts +47 -0
- package/src/error-codes.ts +14 -23
- package/src/exercise-database.ts +40 -7
- package/src/exercise-push-device.ts +51 -0
- package/src/exercise-route-api.ts +74 -0
- package/src/exercise-routes.ts +14 -5
- package/src/exercise-services.ts +3 -1
- package/src/exercise-shard-flag.ts +47 -0
- package/src/fix-command.ts +2 -2
- package/src/generate-factories.ts +5 -11
- package/src/generate-feature-required.ts +9 -4
- package/src/generate-files.ts +20 -2
- package/src/generate-kinds.ts +5 -1
- package/src/guards.ts +21 -6
- package/src/island-bundle-options.ts +48 -0
- package/src/island-bundle.ts +18 -46
- package/src/island-link.ts +5 -0
- package/src/island-outputs.ts +5 -0
- package/src/mcp-errors-verify.ts +35 -0
- package/src/mcp-errors.ts +10 -19
- package/src/mcp-host-logs.ts +121 -0
- package/src/mcp-host.ts +12 -73
- package/src/messages-floor.ts +19 -0
- package/src/messages-status.ts +10 -0
- package/src/messages.ts +21 -0
- package/src/registry.ts +4 -0
- package/src/role-start-types.ts +7 -0
- package/src/role-start.ts +4 -0
- package/src/serve-boot.ts +7 -1
- package/src/serve-env-tls.ts +57 -0
- package/src/solid-loader.ts +27 -10
- package/src/templates/generate-export-rows.ts +136 -0
- package/src/templates/generate-import-rows.ts +186 -0
- package/src/templates/generate-rows-slice.ts +95 -0
- package/src/templates/github/ci.yml.ts +4 -0
- package/src/templates/scaffold-db-package.ts +3 -0
- package/src/templates/scaffold-docs.ts +8 -6
- package/src/templates/scaffold-repo.ts +2 -7
- package/src/templates/scaffold-site.ts +4 -1
- package/src/templates/scaffold-suites.ts +72 -0
- package/src/templates/scaffold-test-services.ts +35 -10
- package/src/templates/scaffold-verify-floor.ts +53 -31
- package/src/templates/shapes/api.ts +4 -0
- package/src/templates/slice-foundation.ts +3 -3
- package/src/unthrown-codes.ts +1 -1
- package/src/upgrade-gate.ts +6 -1
- package/src/upgrade-guards-baseline.ts +43 -0
- package/src/upgrade-guards.ts +37 -2
- package/src/upgrade-report.ts +3 -0
- package/src/verify-coverage-run.ts +42 -11
- package/src/verify-e2e.ts +115 -4
- package/src/verify-floor.ts +27 -0
- package/src/verify-guard-baseline.ts +109 -0
- package/src/verify-live.ts +72 -0
- package/src/verify-merge-skips.ts +51 -0
- package/src/verify-merge.ts +36 -2
- package/src/verify-run.ts +48 -7
- package/src/verify-services.ts +287 -0
- package/src/verify-skip-reason.ts +53 -0
- package/src/verify-strict.ts +108 -0
- package/src/verify-test-command.ts +129 -0
- package/src/verify-tests.ts +39 -126
- package/types/babel-modules.d.ts +2 -0
- package/wiki/CLI-Reference.md +142 -23
- package/wiki/Caching-And-Invalidation.md +1 -1
- package/wiki/Entities-And-Migrations.md +1 -1
- package/wiki/Jobs-And-Workflows.md +3 -3
- package/wiki/Known-Gaps.md +5 -1
- package/wiki/MCP-And-AI.md +1 -1
- package/wiki/PWA-And-Offline.md +1 -1
- package/wiki/Troubleshooting.md +3 -3
- package/wiki/Tutorial-05-Deploy-Free.md +2 -2
- package/wiki/Upgrading.md +3 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// What decides a test file's type, and the `bun test` argv each type's step runs: the ordered
|
|
2
|
+
// ownership rules, the ignore globs, the per-type filters and timeouts. Split from `verify-tests.ts`
|
|
3
|
+
// at its 500-line ceiling, which builds the steps; one definition here, so `x test <type>` and the
|
|
4
|
+
// gate's `<type>` step can never disagree about what a suite is.
|
|
5
|
+
|
|
6
|
+
import type { TestType } from '@ultimat3/testing';
|
|
7
|
+
import { IGNORED_TEST_PATTERNS } from './test-ignores';
|
|
8
|
+
import type { MachinePace } from './verify-pace';
|
|
9
|
+
import { DECLARED_PACE, defaultTimeoutArgs, pacedMs } from './verify-pace';
|
|
10
|
+
|
|
11
|
+
type TypedTest = Exclude<TestType, 'unit'>;
|
|
12
|
+
|
|
13
|
+
const TYPED_SUFFIXES = '{contract,live,job,e2e,eval}';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Every rule that decides a file's type, MOST SPECIFIC FIRST: the first entry a path matches owns
|
|
17
|
+
* it, and no later entry may claim it. Each is a substring `bun test` matches against a file path,
|
|
18
|
+
* which is exactly how bun reads more than one positional filter (measured: `.contract.test.` +
|
|
19
|
+
* `.job.test.` runs the union of both suites, never the intersection).
|
|
20
|
+
*
|
|
21
|
+
* A FILENAME declares a type; a DIRECTORY only fills in for a filename that declares none — which
|
|
22
|
+
* is why the one directory rule is last. Ownership had no order at all until 2026-08, so
|
|
23
|
+
* `packages/app/e2e/payment.contract.test.ts` matched `.contract.test.` AND `e2e/`: the `contract`
|
|
24
|
+
* step selected it by name while the `e2e` step's argv selected it by directory, and one test ran
|
|
25
|
+
* twice in one gate. The bare word `e2e` was worse still — it matched any path holding those three
|
|
26
|
+
* characters anywhere, so `src/e2e-helpers.test.ts` joined the e2e step and left the unit step,
|
|
27
|
+
* which selects by exclusion.
|
|
28
|
+
*/
|
|
29
|
+
const OWNERSHIP = [
|
|
30
|
+
['contract', '.contract.test.'],
|
|
31
|
+
['live', '.live.test.'],
|
|
32
|
+
['job', '.job.test.'],
|
|
33
|
+
['e2e', '.e2e.test.'],
|
|
34
|
+
['eval', '.eval.test.'],
|
|
35
|
+
// `e2e/`, not `/e2e/`: bun matches a filter against the cwd-relative path and answers
|
|
36
|
+
// `Test filter "/e2e/" had no matches` for the anchored form (bun 1.3.14). The trailing slash
|
|
37
|
+
// is the boundary this can express, and it is the same string `ownerOf` ranks last, so the
|
|
38
|
+
// step's argv and the file list can never disagree about what an e2e test is.
|
|
39
|
+
['e2e', 'e2e/'],
|
|
40
|
+
] as const satisfies readonly (readonly [TypedTest, string])[];
|
|
41
|
+
|
|
42
|
+
/** The types whose filename rule outranks the `e2e/` directory — e2e's own never does. */
|
|
43
|
+
const OUTRANKING_E2E: readonly TypedTest[] = [
|
|
44
|
+
...new Set(OWNERSHIP.filter(([type]) => type !== 'e2e').map(([type]) => type)),
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The one suite a path belongs to, and `unit` when no rule claims it — the single definition of a
|
|
49
|
+
* file's type, which both `x test <type>` and the gate's own steps select through. Exactly one
|
|
50
|
+
* owner is the point: two owners is a file two steps run, and a test that runs twice in one gate
|
|
51
|
+
* proves nothing the first run did not.
|
|
52
|
+
*/
|
|
53
|
+
export const ownerOf = (path: string): TestType =>
|
|
54
|
+
OWNERSHIP.find(([, filter]) => path.includes(filter))?.[0] ?? 'unit';
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Paths a suite's own filters match but the suite does NOT own, as `--path-ignore-patterns`. Only
|
|
58
|
+
* `e2e` has any, for the reason above. It has to be said in the argv and not only in `ownerOf`:
|
|
59
|
+
* bun has no "match this and not that" filter, and a serial step runs the argv rather than a file
|
|
60
|
+
* list — so exclusivity that lived only in the file list would still have run the file twice.
|
|
61
|
+
*/
|
|
62
|
+
const disownedBy = (type: TypedTest): readonly string[] =>
|
|
63
|
+
type === 'e2e' ? [`**/e2e/**/*.{${OUTRANKING_E2E.join(',')}}.test.*`] : [];
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Build output, and nested projects that carry their own `x verify`. `examples/**` and
|
|
67
|
+
* `dummy/**` are the second kind: each holds a whole app gated by its own run of this same step
|
|
68
|
+
* list, so collecting them here would report one app failure on two different gates. The patterns
|
|
69
|
+
* are relative to the run's root, so this excludes nothing when the app itself is the root. The
|
|
70
|
+
* policy — which directories, and which are anchored at the root — is `test-ignores.ts`'s, the same
|
|
71
|
+
* one `discoverTests` filters the parallel steps by; this is its glob projection.
|
|
72
|
+
*
|
|
73
|
+
* `dummy/**` was added after the framework gate started running a demo app's tests and disagreeing
|
|
74
|
+
* with `bun run test` — which already excluded it — for no reason a reader could see.
|
|
75
|
+
*
|
|
76
|
+
* Excluded here is not ungated: `scripts/reference-app-gate.ts` runs `x verify` inside each of
|
|
77
|
+
* those apps and blocks on a per-app ratchet. Until 2026-08 that was only true of `examples/**`,
|
|
78
|
+
* and `dummy/social-media-clone` was excluded by this list and gated by nothing.
|
|
79
|
+
*/
|
|
80
|
+
const NEVER_A_TEST = IGNORED_TEST_PATTERNS;
|
|
81
|
+
|
|
82
|
+
const ignoreFlags = (patterns: readonly string[]): readonly string[] =>
|
|
83
|
+
patterns.map((pattern) => `--path-ignore-patterns=${pattern}`);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The substrings that decide a file's type — the same ones the step's `bun test` runs with, so
|
|
87
|
+
* `x test <type>` and the gate's `<type>` step can never disagree about what a contract test is.
|
|
88
|
+
*/
|
|
89
|
+
export const typeFiltersOf = (type: Exclude<TestType, 'unit'>): readonly string[] =>
|
|
90
|
+
OWNERSHIP.filter(([owner]) => owner === type).map(([, filter]) => filter);
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* What an e2e test's path is, as globs: the e2e step's own substrings (`typeFiltersOf('e2e')`),
|
|
94
|
+
* each spelt as the glob matching the same paths. One definition, read three ways — the e2e step
|
|
95
|
+
* selects by the substrings, the unit step ignores these globs, and `scripts/coverage-gate.ts`
|
|
96
|
+
* leaves them out of a package's coverage: an e2e suite drives a built app through a browser and
|
|
97
|
+
* child processes no in-process lcov sees, and it already runs in its own gate step.
|
|
98
|
+
*/
|
|
99
|
+
export const E2E_PATH_GLOBS: readonly string[] = typeFiltersOf('e2e').map((filter) =>
|
|
100
|
+
filter.endsWith('/') ? `**/*${filter}**` : `**/*${filter}*`,
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* An e2e test's own budget: a first navigation waits on `x dev` compiling the route and its island,
|
|
105
|
+
* which bun's default 5 s does not cover — a timeout there reads as an app bug that is not one.
|
|
106
|
+
*/
|
|
107
|
+
export const E2E_TEST_TIMEOUT_MS = 60_000;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Unit is everything the typed suites do not claim, so no test can fall between two steps. Each
|
|
111
|
+
* per-test default is read at the machine's `pace` (`verify-pace.ts`).
|
|
112
|
+
*/
|
|
113
|
+
export const testStepCommand = (type: TestType, pace?: MachinePace): readonly string[] =>
|
|
114
|
+
type === 'unit'
|
|
115
|
+
? [
|
|
116
|
+
'bun',
|
|
117
|
+
'test',
|
|
118
|
+
...defaultTimeoutArgs(pace),
|
|
119
|
+
...ignoreFlags([...NEVER_A_TEST, ...E2E_PATH_GLOBS, `**/*.${TYPED_SUFFIXES}.test.*`]),
|
|
120
|
+
]
|
|
121
|
+
: [
|
|
122
|
+
'bun',
|
|
123
|
+
'test',
|
|
124
|
+
...(type === 'e2e'
|
|
125
|
+
? [`--timeout=${String(pacedMs(E2E_TEST_TIMEOUT_MS, pace ?? DECLARED_PACE))}`]
|
|
126
|
+
: defaultTimeoutArgs(pace)),
|
|
127
|
+
...ignoreFlags([...NEVER_A_TEST, ...disownedBy(type)]),
|
|
128
|
+
...typeFiltersOf(type),
|
|
129
|
+
];
|
package/src/verify-tests.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// One gate step per test type, so every type reports on its own line. A test's type is its
|
|
2
2
|
// filename suffix — `*.contract.test.ts`, `*.live.test.ts`, `*.job.test.ts`, `*.e2e.test.ts`,
|
|
3
|
-
// `*.eval.test.ts` — and only then the `e2e/` directory it sits in, which is why `OWNERSHIP`
|
|
4
|
-
// is an ordered list. Everything else is a unit test,
|
|
3
|
+
// `*.eval.test.ts` — and only then the `e2e/` directory it sits in, which is why `OWNERSHIP`
|
|
4
|
+
// (`verify-test-command.ts`) is an ordered list. Everything else is a unit test, selected by exclusion.
|
|
5
5
|
//
|
|
6
6
|
// `eval` carries one rule beyond its suite — every prompt must have an eval — so it is the only
|
|
7
7
|
// step here that can fail with no test file of its own.
|
|
@@ -19,7 +19,6 @@ import { judgeCoverage } from './coverage-floor';
|
|
|
19
19
|
import { msg } from './messages';
|
|
20
20
|
import { countsOf } from './test-counts';
|
|
21
21
|
import { testEnvOverrides } from './test-dotenv';
|
|
22
|
-
import { IGNORED_TEST_PATTERNS } from './test-ignores';
|
|
23
22
|
import type { TestFile } from './test-select';
|
|
24
23
|
import { discoverTests } from './test-select';
|
|
25
24
|
import { TEST_TIMINGS_FILE } from './test-shards';
|
|
@@ -27,15 +26,17 @@ import { machineLease } from './test-slots';
|
|
|
27
26
|
import type { WorkerPlan } from './test-workers';
|
|
28
27
|
import { availableCpus, SERIAL_TYPES, totalMemory, workerPlan } from './test-workers';
|
|
29
28
|
import { runCovered } from './verify-coverage-run';
|
|
30
|
-
import { withE2eApp } from './verify-e2e';
|
|
29
|
+
import { judgeE2eBrowser, withE2eApp } from './verify-e2e';
|
|
31
30
|
import { factoryFindings } from './verify-factories';
|
|
32
31
|
import { readVerifyFloor } from './verify-floor';
|
|
32
|
+
import { withTestServices } from './verify-live';
|
|
33
33
|
import type { MachinePace } from './verify-pace';
|
|
34
|
-
import {
|
|
34
|
+
import { paceEnv } from './verify-pace';
|
|
35
35
|
import { seedFindings } from './verify-seeds';
|
|
36
36
|
import { shardFiles } from './verify-shard';
|
|
37
37
|
import type { ChangedTestSelection, StepOutcome, VerifyContext, VerifyStep } from './verify-step';
|
|
38
38
|
import { fromExec, fromFindings } from './verify-step';
|
|
39
|
+
import { testStepCommand } from './verify-test-command';
|
|
39
40
|
import { runParallel } from './verify-test-run';
|
|
40
41
|
|
|
41
42
|
/**
|
|
@@ -46,11 +47,17 @@ import { runParallel } from './verify-test-run';
|
|
|
46
47
|
* and `@ultimat3/testing` is already a runtime dependency of this package.
|
|
47
48
|
*/
|
|
48
49
|
export type { TestType } from '@ultimat3/testing';
|
|
50
|
+
// Re-exported: every caller that read a test type's filters or argv here still does.
|
|
51
|
+
export {
|
|
52
|
+
E2E_PATH_GLOBS,
|
|
53
|
+
E2E_TEST_TIMEOUT_MS,
|
|
54
|
+
ownerOf,
|
|
55
|
+
testStepCommand,
|
|
56
|
+
typeFiltersOf,
|
|
57
|
+
} from './verify-test-command';
|
|
49
58
|
|
|
50
59
|
type TypedTest = Exclude<TestType, 'unit'>;
|
|
51
60
|
|
|
52
|
-
const TYPED_SUFFIXES = '{contract,live,job,e2e,eval}';
|
|
53
|
-
|
|
54
61
|
/**
|
|
55
62
|
* `Object.create(null)`, not a `{}` literal, because `stepFor` reads it with a COMPUTED key
|
|
56
63
|
* (`SUMMARIES[type]`). On a normal object literal every `Object.prototype` member reads back as
|
|
@@ -74,124 +81,8 @@ const SUMMARIES: Readonly<Record<TypedTest, string>> = Object.assign(
|
|
|
74
81
|
},
|
|
75
82
|
);
|
|
76
83
|
|
|
77
|
-
/**
|
|
78
|
-
* Every rule that decides a file's type, MOST SPECIFIC FIRST: the first entry a path matches owns
|
|
79
|
-
* it, and no later entry may claim it. Each is a substring `bun test` matches against a file path,
|
|
80
|
-
* which is exactly how bun reads more than one positional filter (measured: `.contract.test.` +
|
|
81
|
-
* `.job.test.` runs the union of both suites, never the intersection).
|
|
82
|
-
*
|
|
83
|
-
* A FILENAME declares a type; a DIRECTORY only fills in for a filename that declares none — which
|
|
84
|
-
* is why the one directory rule is last. Ownership had no order at all until 2026-08, so
|
|
85
|
-
* `packages/app/e2e/payment.contract.test.ts` matched `.contract.test.` AND `e2e/`: the `contract`
|
|
86
|
-
* step selected it by name while the `e2e` step's argv selected it by directory, and one test ran
|
|
87
|
-
* twice in one gate. The bare word `e2e` was worse still — it matched any path holding those three
|
|
88
|
-
* characters anywhere, so `src/e2e-helpers.test.ts` joined the e2e step and left the unit step,
|
|
89
|
-
* which selects by exclusion.
|
|
90
|
-
*/
|
|
91
|
-
const OWNERSHIP = [
|
|
92
|
-
['contract', '.contract.test.'],
|
|
93
|
-
['live', '.live.test.'],
|
|
94
|
-
['job', '.job.test.'],
|
|
95
|
-
['e2e', '.e2e.test.'],
|
|
96
|
-
['eval', '.eval.test.'],
|
|
97
|
-
// `e2e/`, not `/e2e/`: bun matches a filter against the cwd-relative path and answers
|
|
98
|
-
// `Test filter "/e2e/" had no matches` for the anchored form (bun 1.3.14). The trailing slash
|
|
99
|
-
// is the boundary this can express, and it is the same string `ownerOf` ranks last, so the
|
|
100
|
-
// step's argv and the file list can never disagree about what an e2e test is.
|
|
101
|
-
['e2e', 'e2e/'],
|
|
102
|
-
] as const satisfies readonly (readonly [TypedTest, string])[];
|
|
103
|
-
|
|
104
|
-
/** The types whose filename rule outranks the `e2e/` directory — e2e's own never does. */
|
|
105
|
-
const OUTRANKING_E2E: readonly TypedTest[] = [
|
|
106
|
-
...new Set(OWNERSHIP.filter(([type]) => type !== 'e2e').map(([type]) => type)),
|
|
107
|
-
];
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* The one suite a path belongs to, and `unit` when no rule claims it — the single definition of a
|
|
111
|
-
* file's type, which both `x test <type>` and the gate's own steps select through. Exactly one
|
|
112
|
-
* owner is the point: two owners is a file two steps run, and a test that runs twice in one gate
|
|
113
|
-
* proves nothing the first run did not.
|
|
114
|
-
*/
|
|
115
|
-
export const ownerOf = (path: string): TestType =>
|
|
116
|
-
OWNERSHIP.find(([, filter]) => path.includes(filter))?.[0] ?? 'unit';
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Paths a suite's own filters match but the suite does NOT own, as `--path-ignore-patterns`. Only
|
|
120
|
-
* `e2e` has any, for the reason above. It has to be said in the argv and not only in `ownerOf`:
|
|
121
|
-
* bun has no "match this and not that" filter, and a serial step runs the argv rather than a file
|
|
122
|
-
* list — so exclusivity that lived only in the file list would still have run the file twice.
|
|
123
|
-
*/
|
|
124
|
-
const disownedBy = (type: TypedTest): readonly string[] =>
|
|
125
|
-
type === 'e2e' ? [`**/e2e/**/*.{${OUTRANKING_E2E.join(',')}}.test.*`] : [];
|
|
126
|
-
|
|
127
84
|
const isSerial = (type: TestType): boolean => SERIAL_TYPES.includes(type);
|
|
128
85
|
|
|
129
|
-
/**
|
|
130
|
-
* Build output, and nested projects that carry their own `x verify`. `examples/**` and
|
|
131
|
-
* `dummy/**` are the second kind: each holds a whole app gated by its own run of this same step
|
|
132
|
-
* list, so collecting them here would report one app failure on two different gates. The patterns
|
|
133
|
-
* are relative to the run's root, so this excludes nothing when the app itself is the root. The
|
|
134
|
-
* policy — which directories, and which are anchored at the root — is `test-ignores.ts`'s, the same
|
|
135
|
-
* one `discoverTests` filters the parallel steps by; this is its glob projection.
|
|
136
|
-
*
|
|
137
|
-
* `dummy/**` was added after the framework gate started running a demo app's tests and disagreeing
|
|
138
|
-
* with `bun run test` — which already excluded it — for no reason a reader could see.
|
|
139
|
-
*
|
|
140
|
-
* Excluded here is not ungated: `scripts/reference-app-gate.ts` runs `x verify` inside each of
|
|
141
|
-
* those apps and blocks on a per-app ratchet. Until 2026-08 that was only true of `examples/**`,
|
|
142
|
-
* and `dummy/social-media-clone` was excluded by this list and gated by nothing.
|
|
143
|
-
*/
|
|
144
|
-
const NEVER_A_TEST = IGNORED_TEST_PATTERNS;
|
|
145
|
-
|
|
146
|
-
const ignoreFlags = (patterns: readonly string[]): readonly string[] =>
|
|
147
|
-
patterns.map((pattern) => `--path-ignore-patterns=${pattern}`);
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* The substrings that decide a file's type — the same ones the step's `bun test` runs with, so
|
|
151
|
-
* `x test <type>` and the gate's `<type>` step can never disagree about what a contract test is.
|
|
152
|
-
*/
|
|
153
|
-
export const typeFiltersOf = (type: Exclude<TestType, 'unit'>): readonly string[] =>
|
|
154
|
-
OWNERSHIP.filter(([owner]) => owner === type).map(([, filter]) => filter);
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* What an e2e test's path is, as globs: the e2e step's own substrings (`typeFiltersOf('e2e')`),
|
|
158
|
-
* each spelt as the glob matching the same paths. One definition, read three ways — the e2e step
|
|
159
|
-
* selects by the substrings, the unit step ignores these globs, and `scripts/coverage-gate.ts`
|
|
160
|
-
* leaves them out of a package's coverage: an e2e suite drives a built app through a browser and
|
|
161
|
-
* child processes no in-process lcov sees, and it already runs in its own gate step.
|
|
162
|
-
*/
|
|
163
|
-
export const E2E_PATH_GLOBS: readonly string[] = typeFiltersOf('e2e').map((filter) =>
|
|
164
|
-
filter.endsWith('/') ? `**/*${filter}**` : `**/*${filter}*`,
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* An e2e test's own budget: a first navigation waits on `x dev` compiling the route and its island,
|
|
169
|
-
* which bun's default 5 s does not cover — a timeout there reads as an app bug that is not one.
|
|
170
|
-
*/
|
|
171
|
-
export const E2E_TEST_TIMEOUT_MS = 60_000;
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Unit is everything the typed suites do not claim, so no test can fall between two steps. Each
|
|
175
|
-
* per-test default is read at the machine's `pace` (`verify-pace.ts`).
|
|
176
|
-
*/
|
|
177
|
-
export const testStepCommand = (type: TestType, pace?: MachinePace): readonly string[] =>
|
|
178
|
-
type === 'unit'
|
|
179
|
-
? [
|
|
180
|
-
'bun',
|
|
181
|
-
'test',
|
|
182
|
-
...defaultTimeoutArgs(pace),
|
|
183
|
-
...ignoreFlags([...NEVER_A_TEST, ...E2E_PATH_GLOBS, `**/*.${TYPED_SUFFIXES}.test.*`]),
|
|
184
|
-
]
|
|
185
|
-
: [
|
|
186
|
-
'bun',
|
|
187
|
-
'test',
|
|
188
|
-
...(type === 'e2e'
|
|
189
|
-
? [`--timeout=${String(pacedMs(E2E_TEST_TIMEOUT_MS, pace ?? DECLARED_PACE))}`]
|
|
190
|
-
: defaultTimeoutArgs(pace)),
|
|
191
|
-
...ignoreFlags([...NEVER_A_TEST, ...disownedBy(type)]),
|
|
192
|
-
...typeFiltersOf(type),
|
|
193
|
-
];
|
|
194
|
-
|
|
195
86
|
/**
|
|
196
87
|
* Whether a step applies and what it runs are now one question with one answer: the file list.
|
|
197
88
|
* They used to be two — a glob for `applies`, `--path-ignore-patterns` for the run — and when they
|
|
@@ -244,11 +135,17 @@ const runSerial = async (
|
|
|
244
135
|
const result =
|
|
245
136
|
type === 'e2e'
|
|
246
137
|
? await withE2eApp(
|
|
247
|
-
{
|
|
138
|
+
{
|
|
139
|
+
root: ctx.root,
|
|
140
|
+
isApp: isApp(ctx.root),
|
|
141
|
+
command,
|
|
142
|
+
env: envOverrides,
|
|
143
|
+
hostEnv: ctx.env ?? Bun.env,
|
|
144
|
+
},
|
|
248
145
|
exec,
|
|
249
146
|
)
|
|
250
147
|
: await exec({ command, env: envOverrides });
|
|
251
|
-
|
|
148
|
+
const outcome: StepOutcome = {
|
|
252
149
|
...fromExec(result, {
|
|
253
150
|
code: 'X_TEST_FAILED',
|
|
254
151
|
cause: `one or more ${type} tests failed`,
|
|
@@ -257,6 +154,16 @@ const runSerial = async (
|
|
|
257
154
|
workers: 1,
|
|
258
155
|
tests: countsOf([result]),
|
|
259
156
|
};
|
|
157
|
+
// A floored e2e step that found no browser says which browser to install, never only "re-run".
|
|
158
|
+
return type === 'e2e'
|
|
159
|
+
? await judgeE2eBrowser({
|
|
160
|
+
root: ctx.root,
|
|
161
|
+
isApp: isApp(ctx.root),
|
|
162
|
+
outcome,
|
|
163
|
+
env: ctx.env ?? Bun.env,
|
|
164
|
+
sharded: ctx.shard !== undefined,
|
|
165
|
+
})
|
|
166
|
+
: outcome;
|
|
260
167
|
};
|
|
261
168
|
|
|
262
169
|
/**
|
|
@@ -484,5 +391,11 @@ const stepFor = (type: TestType): VerifyStep => {
|
|
|
484
391
|
};
|
|
485
392
|
};
|
|
486
393
|
|
|
394
|
+
/** One test type's step BEFORE the live wrap: what `verify-live.test.ts` wraps over its own probe. */
|
|
395
|
+
export const bareTestStep = stepFor;
|
|
396
|
+
|
|
487
397
|
/** In cost order: unit needs nothing, e2e needs a build. */
|
|
488
|
-
|
|
398
|
+
// The live step brings up the app's own test database when none answers (`verify-live.ts`).
|
|
399
|
+
export const TEST_STEPS: readonly VerifyStep[] = TEST_TYPES.map(stepFor).map((step) =>
|
|
400
|
+
step.name === 'live' ? withTestServices(step) : step,
|
|
401
|
+
);
|
package/types/babel-modules.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ declare module '@babel/core' {
|
|
|
8
8
|
readonly filename?: string;
|
|
9
9
|
readonly babelrc?: boolean;
|
|
10
10
|
readonly configFile?: boolean;
|
|
11
|
+
/** Keep each output line at its source line number — a coverage build's only. */
|
|
12
|
+
readonly retainLines?: boolean;
|
|
11
13
|
readonly parserOpts?: { readonly plugins?: readonly string[] };
|
|
12
14
|
/** `[preset, options]` pairs. The preset itself is opaque here — it is never called. */
|
|
13
15
|
readonly presets?: readonly (readonly [unknown, unknown])[];
|