@test-station/cli 0.1.7 → 0.2.10
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/README.md +77 -5
- package/package.json +3 -3
- package/src/index.js +11 -3
package/README.md
CHANGED
|
@@ -28,6 +28,8 @@ Typical cases:
|
|
|
28
28
|
A run produces:
|
|
29
29
|
|
|
30
30
|
- `report.json`: normalized machine-readable results
|
|
31
|
+
- `modules.json`: module/theme rollups for machine consumers
|
|
32
|
+
- `ownership.json`: module/theme ownership rollups
|
|
31
33
|
- `index.html`: interactive HTML report
|
|
32
34
|
- `raw/`: per-suite raw artifacts and framework output
|
|
33
35
|
|
|
@@ -167,6 +169,7 @@ With `@test-station/cli` installed, run it with:
|
|
|
167
169
|
```sh
|
|
168
170
|
npx test-station run --config ./test-station.config.mjs
|
|
169
171
|
npx test-station run --config ./test-station.config.mjs --coverage
|
|
172
|
+
npx test-station run --config ./test-station.config.mjs --no-coverage
|
|
170
173
|
```
|
|
171
174
|
|
|
172
175
|
### Package Script Integration
|
|
@@ -177,7 +180,8 @@ npx test-station run --config ./test-station.config.mjs --coverage
|
|
|
177
180
|
{
|
|
178
181
|
"scripts": {
|
|
179
182
|
"test": "test-station run --config ./test-station.config.mjs",
|
|
180
|
-
"test:coverage": "test-station run --config ./test-station.config.mjs --coverage"
|
|
183
|
+
"test:coverage": "test-station run --config ./test-station.config.mjs --coverage",
|
|
184
|
+
"test:fast": "test-station run --config ./test-station.config.mjs --no-coverage"
|
|
181
185
|
}
|
|
182
186
|
}
|
|
183
187
|
```
|
|
@@ -188,7 +192,8 @@ npx test-station run --config ./test-station.config.mjs --coverage
|
|
|
188
192
|
{
|
|
189
193
|
"scripts": {
|
|
190
194
|
"test": "test-station run --config ./test-station.config.mjs",
|
|
191
|
-
"test:coverage": "test-station run --config ./test-station.config.mjs --coverage"
|
|
195
|
+
"test:coverage": "test-station run --config ./test-station.config.mjs --coverage",
|
|
196
|
+
"test:fast": "test-station run --config ./test-station.config.mjs --no-coverage"
|
|
192
197
|
}
|
|
193
198
|
}
|
|
194
199
|
```
|
|
@@ -199,11 +204,30 @@ npx test-station run --config ./test-station.config.mjs --coverage
|
|
|
199
204
|
{
|
|
200
205
|
"scripts": {
|
|
201
206
|
"test": "test-station run --config ./test-station.config.mjs",
|
|
202
|
-
"test:coverage": "test-station run --config ./test-station.config.mjs --coverage"
|
|
207
|
+
"test:coverage": "test-station run --config ./test-station.config.mjs --coverage",
|
|
208
|
+
"test:fast": "test-station run --config ./test-station.config.mjs --no-coverage"
|
|
203
209
|
}
|
|
204
210
|
}
|
|
205
211
|
```
|
|
206
212
|
|
|
213
|
+
### CLI Commands And Overrides
|
|
214
|
+
|
|
215
|
+
The public CLI surface is:
|
|
216
|
+
|
|
217
|
+
```sh
|
|
218
|
+
npx test-station inspect --config ./test-station.config.mjs
|
|
219
|
+
npx test-station run --config ./test-station.config.mjs --coverage --workspace app --output-dir ./artifacts/app-report
|
|
220
|
+
npx test-station render --input ./artifacts/test-report/report.json --output ./artifacts/test-report
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Useful overrides:
|
|
224
|
+
|
|
225
|
+
- `--coverage` and `--no-coverage` override `execution.defaultCoverage`
|
|
226
|
+
- `--workspace <name>` and `--package <name>` are equivalent repeatable filters
|
|
227
|
+
- `--output-dir <path>` overrides `project.outputDir` and rewrites `raw/` under that directory
|
|
228
|
+
|
|
229
|
+
When filters match no suites, the run exits with a clear error. If `workspaceDiscovery.packages` still lists other workspaces, those unmatched packages remain visible as `skipped`.
|
|
230
|
+
|
|
207
231
|
## Integration Model
|
|
208
232
|
|
|
209
233
|
A host project typically owns only three things:
|
|
@@ -229,6 +253,12 @@ If `workspaceDiscovery.packages` lists a package with no matching suites, that p
|
|
|
229
253
|
|
|
230
254
|
If a suite runs and the underlying framework reports zero tests, the suite is normalized as `skipped`.
|
|
231
255
|
|
|
256
|
+
### Adapter Notes
|
|
257
|
+
|
|
258
|
+
- `node-test` coverage works for direct `node --test ...` commands and package scripts that resolve directly to a single `node --test ...` invocation
|
|
259
|
+
- `playwright` can collect browser Istanbul coverage when `suite.coverage.strategy` is `browser-istanbul`
|
|
260
|
+
- `shell` supports `resultFormat: 'single-check-json-v1'` for structured single-check outputs with mapped warnings and raw details
|
|
261
|
+
|
|
232
262
|
### Playwright In CI
|
|
233
263
|
|
|
234
264
|
Consumers using the built-in Playwright adapter must install Playwright browsers in CI before running the reporter.
|
|
@@ -286,7 +316,7 @@ There are two supported consumer modes:
|
|
|
286
316
|
|
|
287
317
|
For local-reference mode, keep host imports pointed at the root-level entrypoints above rather than `packages/*/src`.
|
|
288
318
|
|
|
289
|
-
### Classification, Coverage Attribution, And
|
|
319
|
+
### Classification, Coverage Attribution, Ownership, And Thresholds
|
|
290
320
|
|
|
291
321
|
If you want the report grouped by product or subsystem instead of leaving tests uncategorized, provide a manifest file.
|
|
292
322
|
|
|
@@ -315,6 +345,23 @@ If you want the report grouped by product or subsystem instead of leaving tests
|
|
|
315
345
|
"themes": [
|
|
316
346
|
{ "module": "runtime", "theme": "api", "owner": "runtime-api-team" }
|
|
317
347
|
]
|
|
348
|
+
},
|
|
349
|
+
"thresholds": {
|
|
350
|
+
"modules": [
|
|
351
|
+
{
|
|
352
|
+
"module": "runtime",
|
|
353
|
+
"coverage": { "linesPct": 80, "branchesPct": 70 },
|
|
354
|
+
"enforcement": "error"
|
|
355
|
+
}
|
|
356
|
+
],
|
|
357
|
+
"themes": [
|
|
358
|
+
{
|
|
359
|
+
"module": "runtime",
|
|
360
|
+
"theme": "api",
|
|
361
|
+
"coverage": { "linesPct": 75 },
|
|
362
|
+
"enforcement": "warn"
|
|
363
|
+
}
|
|
364
|
+
]
|
|
318
365
|
}
|
|
319
366
|
}
|
|
320
367
|
```
|
|
@@ -326,9 +373,31 @@ manifests: {
|
|
|
326
373
|
classification: './test-modules.json',
|
|
327
374
|
coverageAttribution: './test-modules.json',
|
|
328
375
|
ownership: './test-modules.json',
|
|
376
|
+
thresholds: './test-modules.json',
|
|
329
377
|
}
|
|
330
378
|
```
|
|
331
379
|
|
|
380
|
+
Error-enforced threshold failures are reported in `report.json`, rendered in HTML, and cause `test-station run` to exit non-zero even when every suite itself passed. Warning-enforced thresholds stay visible in the report but do not fail the process.
|
|
381
|
+
|
|
382
|
+
### Failure Diagnostics
|
|
383
|
+
|
|
384
|
+
Suites can define an optional diagnostics rerun. When the suite fails, `test-station` reruns the configured command, captures stdout/stderr, and writes the diagnostic artifacts under `raw/diagnostics/`.
|
|
385
|
+
|
|
386
|
+
```js
|
|
387
|
+
{
|
|
388
|
+
id: 'web-unit',
|
|
389
|
+
adapter: 'vitest',
|
|
390
|
+
command: ['yarn', 'vitest', 'run', '--config', './vitest.config.js'],
|
|
391
|
+
diagnostics: {
|
|
392
|
+
label: 'Verbose rerun',
|
|
393
|
+
command: ['yarn', 'vitest', 'run', '--config', './vitest.config.js', '--reporter', 'verbose'],
|
|
394
|
+
timeoutMs: 120000,
|
|
395
|
+
},
|
|
396
|
+
}
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
The rerun metadata is attached to the suite result as `suite.diagnostics`, linked from the HTML report, and summarized in the console output.
|
|
400
|
+
|
|
332
401
|
### Custom Policy Plugins
|
|
333
402
|
|
|
334
403
|
A plugin can hook into these stages:
|
|
@@ -366,10 +435,13 @@ Run the standalone repo checks with:
|
|
|
366
435
|
|
|
367
436
|
```sh
|
|
368
437
|
yarn lint
|
|
438
|
+
yarn test:node
|
|
369
439
|
yarn test
|
|
370
440
|
yarn build
|
|
371
441
|
```
|
|
372
442
|
|
|
443
|
+
`yarn test:node` runs the direct Node test suite. `yarn test` runs the repository through `test-station` itself and produces the self-test report.
|
|
444
|
+
|
|
373
445
|
The current external-consumer smoke path is:
|
|
374
446
|
|
|
375
447
|
```sh
|
|
@@ -378,7 +450,7 @@ node ./bin/test-station.mjs run --config ./examples/generic-node-library/test-st
|
|
|
378
450
|
|
|
379
451
|
## Versioning
|
|
380
452
|
|
|
381
|
-
All publishable `@test-station/*` packages currently move in lockstep at `0.
|
|
453
|
+
All publishable `@test-station/*` packages currently move in lockstep at `0.2.0`.
|
|
382
454
|
|
|
383
455
|
For deeper release and compatibility details, see:
|
|
384
456
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@test-station/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
".": "./src/index.js"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@test-station/core": "0.
|
|
16
|
-
"@test-station/render-html": "0.
|
|
15
|
+
"@test-station/core": "0.2.10",
|
|
16
|
+
"@test-station/render-html": "0.2.10"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "node ../../scripts/check-package.mjs ./src/index.js && node --check ./src/cli.js",
|
package/src/index.js
CHANGED
|
@@ -10,7 +10,7 @@ export function parseCliArgs(argv) {
|
|
|
10
10
|
output: null,
|
|
11
11
|
outputDir: null,
|
|
12
12
|
dryRun: false,
|
|
13
|
-
coverage:
|
|
13
|
+
coverage: undefined,
|
|
14
14
|
workspaceFilters: [],
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -47,6 +47,10 @@ export function parseCliArgs(argv) {
|
|
|
47
47
|
}
|
|
48
48
|
if (token === '--coverage') {
|
|
49
49
|
parsed.coverage = true;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (token === '--no-coverage') {
|
|
53
|
+
parsed.coverage = false;
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
56
|
|
|
@@ -59,7 +63,7 @@ export function renderHelp() {
|
|
|
59
63
|
'',
|
|
60
64
|
'Commands:',
|
|
61
65
|
' test-station inspect --config ./test-station.config.mjs',
|
|
62
|
-
' test-station run --config ./test-station.config.mjs [--dry-run] [--coverage] [--workspace <name>|--package <name>] [--output-dir <path>]',
|
|
66
|
+
' test-station run --config ./test-station.config.mjs [--dry-run] [--coverage|--no-coverage] [--workspace <name>|--package <name>] [--output-dir <path>]',
|
|
63
67
|
' test-station render --input ./artifacts/workspace-tests/report.json --output ./artifacts/workspace-tests',
|
|
64
68
|
].join('\n');
|
|
65
69
|
}
|
|
@@ -112,7 +116,11 @@ export async function runCli(argv = process.argv.slice(2)) {
|
|
|
112
116
|
process.stdout.write(`${JSON.stringify({ report: execution.artifactPaths.reportJsonPath, html: htmlPath }, null, 2)}\n`);
|
|
113
117
|
}
|
|
114
118
|
|
|
115
|
-
return execution.report.summary.failedPackages > 0
|
|
119
|
+
return execution.report.summary.failedPackages > 0
|
|
120
|
+
|| execution.report.summary.failedSuites > 0
|
|
121
|
+
|| (execution.report.summary?.policy?.failedThresholds || 0) > 0
|
|
122
|
+
? 1
|
|
123
|
+
: 0;
|
|
116
124
|
}
|
|
117
125
|
|
|
118
126
|
if (args.command === 'render') {
|