@jterrazz/test 18.0.4 → 18.1.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/dist/config.js +10 -4
- package/dist/vitest.d.ts +4 -1
- package/dist/vitest.js +8 -1
- package/docs/guides/lint-specs.md +4 -0
- package/docs/start/set-up-a-project.md +1 -1
- package/package.json +2 -2
package/dist/config.js
CHANGED
|
@@ -19,10 +19,16 @@ var standard_default = defineStandard({ test: {
|
|
|
19
19
|
"mobile",
|
|
20
20
|
"website"
|
|
21
21
|
],
|
|
22
|
-
projects: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
projects: {
|
|
23
|
+
lint: {
|
|
24
|
+
isolate: false,
|
|
25
|
+
reason: "a lint spec lays its own fixture tree and runs the linters as processes of their own, so a worker runs its files in one module graph"
|
|
26
|
+
},
|
|
27
|
+
unit: {
|
|
28
|
+
isolate: false,
|
|
29
|
+
reason: "a module test leaves no state behind in a module, so a worker runs its files in one module graph"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
26
32
|
} });
|
|
27
33
|
//#endregion
|
|
28
34
|
//#region lint/kit/project/loaded-packages.ts
|
package/dist/vitest.d.ts
CHANGED
|
@@ -98,7 +98,10 @@ export declare function job(options?: JobProjectOptions): TestProjectInlineConfi
|
|
|
98
98
|
//#endregion
|
|
99
99
|
//#region src/specifications/lint/lint.project.d.ts
|
|
100
100
|
/** `lint()`: the rules a project ships, run by the real linters over fixture trees. */
|
|
101
|
-
type LintProjectOptions = SpecificationProjectOptions
|
|
101
|
+
type LintProjectOptions = SpecificationProjectOptions & {
|
|
102
|
+
/** `false` shares one module graph per worker (`isolate: false`); for specs that keep no state in a module. */
|
|
103
|
+
isolate?: boolean;
|
|
104
|
+
};
|
|
102
105
|
export declare function lint(options?: LintProjectOptions): TestProjectInlineConfiguration;
|
|
103
106
|
//#endregion
|
|
104
107
|
//#region src/specifications/mobile/mobile.project.d.ts
|
package/dist/vitest.js
CHANGED
|
@@ -378,7 +378,14 @@ function job(options = {}) {
|
|
|
378
378
|
//#endregion
|
|
379
379
|
//#region src/specifications/lint/lint.project.ts
|
|
380
380
|
function lint(options = {}) {
|
|
381
|
-
|
|
381
|
+
const project = specificationProject("lint", options);
|
|
382
|
+
return options.isolate === void 0 ? project : {
|
|
383
|
+
...project,
|
|
384
|
+
test: {
|
|
385
|
+
...project.test,
|
|
386
|
+
isolate: options.isolate
|
|
387
|
+
}
|
|
388
|
+
};
|
|
382
389
|
}
|
|
383
390
|
//#endregion
|
|
384
391
|
//#region src/specifications/mobile/mobile.project.ts
|
|
@@ -134,6 +134,10 @@ A preset's own `oxlint` (its plugin, its rulebook) is not run by `presets`: the
|
|
|
134
134
|
|
|
135
135
|
A linter that fails and reports no diagnostic is refused in four parts rather than read as a clean tree: a plugin that does not load, a config oxlint cannot build, a checker that cannot start.
|
|
136
136
|
|
|
137
|
+
### One module graph per worker
|
|
138
|
+
|
|
139
|
+
The lint project runs a worker's files in one module graph (`isolate: false`), as the standard hands it: each spec lays its own fixture tree and runs the linters as processes of their own, so a file leaves nothing in a module for the next one, and the worker, the framework and the kit load once per worker instead of once per file. A project whose lint specs keep state in a module (a cache, a counter, a stub set at load) states `isolate: true` for its `lint` project in `jterrazz.config.ts`, with its reason.
|
|
140
|
+
|
|
137
141
|
### A rule pack: a nested Vitest and a reporter fixture
|
|
138
142
|
|
|
139
143
|
A package that ships lint rules for other projects proves them by running the real binary on a tree: the spec starts a nested `vitest` over a fixture project (`.fixture(directory(...))`) with a reporter fixture that prints one line per finding, and compares that output whole. A rule alone is `ruleTester()`.
|
|
@@ -108,7 +108,7 @@ There is one helper per kind (`unit`, `integration`, `component`, `website`, `mo
|
|
|
108
108
|
| `timeout` | Raise or lower the 30 s default for this project alone: each test's and each hook's, so the `afterAll` that stops what a slow test started has the same budget |
|
|
109
109
|
| `serial` | Run the project's files one at a time (`fileParallelism: false`), when they share one server, one file, one app |
|
|
110
110
|
|
|
111
|
-
`unit()` and `component()` are a pair: `unit()` collects `**/*.test.ts` outside `specs/` and leaves out `**/*.test.tsx`, which `component()` collects. So the suffix beside a file decides which project runs it. `unit()` also takes `roots` when the modules are not at the repository root, and `isolate: false` to run a worker's files in one module graph, only for a project whose tests leave no state behind in a module, and the default `vitestConfig` hands it. `component()` takes the options of the app it renders (`vite`, `wrap`, `viewport`, `clock`, `timezone`, `locale`, `root`), described in [Component specs](../guides/component-specs.md#the-constructor-there-is-none); `mobile()` takes the simulator the run shares ([Mobile specs](../guides/mobile-specs.md#one-session-per-run)).
|
|
111
|
+
`unit()` and `component()` are a pair: `unit()` collects `**/*.test.ts` outside `specs/` and leaves out `**/*.test.tsx`, which `component()` collects. So the suffix beside a file decides which project runs it. `unit()` also takes `roots` when the modules are not at the repository root, and `isolate: false` to run a worker's files in one module graph, only for a project whose tests leave no state behind in a module, and the default `vitestConfig` hands it. `lint()` takes `isolate` too, and the default `vitestConfig` hands it `false` as well, since a lint spec lays its own tree and runs the linters as processes of their own ([Lint specs § One module graph per worker](../guides/lint-specs.md#one-module-graph-per-worker)); `mobile()` keeps every file isolated. `component()` takes the options of the app it renders (`vite`, `wrap`, `viewport`, `clock`, `timezone`, `locale`, `root`), described in [Component specs](../guides/component-specs.md#the-constructor-there-is-none); `mobile()` takes the simulator the run shares ([Mobile specs](../guides/mobile-specs.md#one-session-per-run)).
|
|
112
112
|
|
|
113
113
|
Every project runs in one group, on the workers the preset sizes ([below](#what-the-preset-sets)): a `website` file takes a worker as a node file does, and the `component` pages run beside them in their one Chromium, as many at once as the run has workers. A project whose files run one at a time (`serial`, and `mobile()` unless it states `serial: false`) runs after that group, in a group of its own, so a simulator never shares its machine.
|
|
114
114
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jterrazz/test",
|
|
3
|
-
"version": "18.0
|
|
3
|
+
"version": "18.1.0",
|
|
4
4
|
"description": "Declarative testing framework for HTTP APIs, CLIs, background jobs, websites, mobile apps, rendered components and the rules a project ships: one entry point, real infrastructure and a real browser, golden-file assertions, plus an oxlint convention plugin.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api-testing",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@hono/node-server": "^2.1.1",
|
|
95
|
-
"@jterrazz/typescript": "^11.
|
|
95
|
+
"@jterrazz/typescript": "^11.2.0",
|
|
96
96
|
"@types/better-sqlite3": "^9.6.0",
|
|
97
97
|
"@types/node": "^26.6.2",
|
|
98
98
|
"@types/pg": "^8.23.1",
|