@tested/cli 0.1.7 → 0.1.9

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.
Files changed (4) hide show
  1. package/README.md +83 -2
  2. package/dist/td.js +1333 -180
  3. package/dist/tested.js +1333 -180
  4. package/package.json +10 -13
package/README.md CHANGED
@@ -25,7 +25,7 @@ CI uses the composite Action (`tested-hq/cli/action@main`). It installs `@tested
25
25
  ```yaml
26
26
  - uses: tested-hq/cli/action@main
27
27
  with:
28
- version: 0.1.7
28
+ version: 0.1.9
29
29
  token: ${{ secrets.TESTED_TOKEN }}
30
30
  ```
31
31
 
@@ -130,12 +130,72 @@ No executable lines in the patch — patch gate skipped. Project threshold met.
130
130
 
131
131
  If `thresholds` is missing from `.tested.yaml`, `tested check` prints a notice on stderr and exits 0 — configs that haven't opted in stay green.
132
132
 
133
+ ### Flags (per package)
134
+
135
+ Independent floors so a monorepo total cannot hide one package. Each flag is graded from **this run's** coverage files.
136
+
137
+ ```yaml
138
+ flags:
139
+ frontend:
140
+ paths: ["apps/web/**", "packages/ui/**"]
141
+ thresholds:
142
+ patch: 90 # inherits project from thresholds.project
143
+ backend:
144
+ paths: ["apps/api/**"]
145
+ ```
146
+
147
+ `tested check` applies global `thresholds` plus each flag whose paths appear in the merged coverage. Per-flag patch is new executable lines in those paths. A flag with no files this run is **skipped** (not 0%) — an affected-graph or scoped job that did not collect that package is not a fail.
148
+
149
+ A job already scoped to one package: `tested check --flag frontend` (Action `flag:`). That coverage file **is** the flag. Other packages are omitted from this upload.
150
+
151
+ `--json` lists per-flag results (`flags.frontend.patchCheck` → `tested.dev / patch / frontend`). Skipped flags have `status: missing` and `skipped: true` with no `executable` / `pct`. `tested push` omits skipped flags from ingest so the last successful upload for that package still stands. `tested diff --json` includes the same map as check.
152
+
153
+ ## Coverage formats
154
+
155
+ `tested diff` / `tested check` / `tested push` all read the same internal model (file path + statement hits). Parsers normalize these artifacts into that model:
156
+
157
+ | `coverage.format` | Typical path | Produced by |
158
+ |---|---|---|
159
+ | `istanbul-json` (or `v8-json`) | `coverage/coverage-final.json` | Vitest, Jest, nyc — V8 coverage emitted as Istanbul JSON |
160
+ | `lcov` | `coverage/lcov.info`, `*.lcov` | lcov, vitest lcov reporter, pytest-cov `--cov-report=lcov` |
161
+ | `cobertura` | `coverage/cobertura.xml`, `coverage.xml` | Cobertura, pytest-cov `--cov-report=xml` |
162
+ | `jacoco` | `jacoco.xml` | JaCoCo (Maven / Gradle) |
163
+ | `gcov` | `*.gcov` or a directory of them | GNU `gcov` **text** reports (not raw `.gcno` / `.gcda` notes) |
164
+ | `simplecov` | `coverage/.resultset.json` | SimpleCov (Ruby) |
165
+
166
+ When `coverage.format` is omitted, the CLI auto-detects from the filename and, if needed, the file contents. `coverage/coverage-final.json` is treated as Istanbul/V8 JSON (the default). Set format explicitly in `.tested.yaml` when you want to pin it:
167
+
168
+ ```yaml
169
+ coverage:
170
+ path: coverage/lcov.info
171
+ format: lcov # optional — auto-detected from lcov.info
172
+ ```
173
+
174
+ Multiple files in one job are merged (union of paths, **max** hits — not averaged, not last-file-wins):
175
+
176
+ ```yaml
177
+ coverage:
178
+ path:
179
+ - coverage/lcov.info
180
+ - coverage/python.xml
181
+ ```
182
+
183
+ Or pass `--file` repeatedly / Action `files`. A CI matrix must not conclude the gate on shard 1 of N: `tested push --parts N --part 1` sends `coverageMerge.complete: false`; only `--complete` or the last part posts checks. See the Action README on GitHub (`tested-hq/cli/action`).
184
+
185
+ `ignores` globs apply after parse, same as before.
186
+
187
+ **pytest-cov:** emit lcov or Cobertura XML (`--cov-report=lcov` / `--cov-report=xml`). coverage.py JSON is not ingested.
188
+
189
+ **gcov:** run `gcov` on your `.gcda` files in CI and point `coverage.path` at the resulting `.gcov` text (or the directory that contains them). Binary notes are not parsed.
190
+
191
+ **SimpleCov:** the default `coverage/.resultset.json` (and the `simplecov-json` gem report) are accepted. Array index 0 is line 1; `null` is non-executable.
192
+
133
193
  ### GitHub Actions
134
194
 
135
195
  ```yaml
136
196
  - uses: tested-hq/cli/action@main
137
197
  with:
138
- version: 0.1.7
198
+ version: 0.1.9
139
199
  push: true
140
200
  pr-number: ${{ github.event.pull_request.number }}
141
201
  token: ${{ secrets.TESTED_TOKEN }}
@@ -150,6 +210,8 @@ $ tested check --json
150
210
  {"patch":{"pct":87.3,"threshold":80,"pass":true},"project":{"pct":92.1,"threshold":90,"pass":true},"overall":"pass"}
151
211
  ```
152
212
 
213
+ When `flags` are configured, `tested check --json` and `tested diff --json` include a `flags` map (status, patch/project totals, and `tested.dev / patch / <name>` slugs). `tested push` posts that same map as a sibling field on the ingest body.
214
+
153
215
  `--json` suppresses the human layout; the exit code is unchanged.
154
216
 
155
217
  ## Share (`tested push`)
@@ -173,7 +235,11 @@ $ tested push
173
235
  | `--owner` / `--name` | Repo identity (default: `GITHUB_REPOSITORY`, else `origin` remote) |
174
236
  | `--pr-title`, `--author`, `--base-ref`, `--head-ref` | PR metadata overrides |
175
237
  | `--base` | Git base for the coverage diff (same as `tested diff --base`) |
238
+ | `--junit` / `TESTED_JUNIT` | JUnit XML for flakes / suite time (or auto-detect `junit.xml`, `test-results/junit.xml`, `coverage/junit.xml`) |
176
239
  | `--run-url` | Optional CI run URL |
240
+ | `--file` | Coverage file to merge (repeatable) |
241
+ | `--parts` / `--part` / `--complete` / `--incomplete` | Matrix shard handshake (`coverageMerge`) |
242
+ | `--run-id` / `--shard` | Group shards for one CI run + SHA |
177
243
  | `--json` | Machine output: `{ "shareUrl", "expiresAt?" }` |
178
244
 
179
245
  ### `tested run` extra args
@@ -192,3 +258,18 @@ Typical CI step after `tested check`:
192
258
  env:
193
259
  TESTED_TOKEN: ${{ secrets.TESTED_TOKEN }}
194
260
  ```
261
+
262
+ ## Release
263
+
264
+ Ship `@tested/cli` from a GitHub Release. `.github/workflows/release.yml` publishes to npm with [trusted publishing](https://docs.npmjs.com/trusted-publishers/) (OIDC). No `NPM_TOKEN`.
265
+
266
+ 1. Bump `version` in `package.json` on `main` and merge.
267
+ 2. From that commit: `gh release create vX.Y.Z --generate-notes` (tag must match `package.json`, e.g. `v0.1.9` → `0.1.9`).
268
+
269
+ One-time npmjs.com setup (package settings → Trusted Publisher → GitHub Actions):
270
+
271
+ - Organization: `tested-hq`
272
+ - Repository: `cli`
273
+ - Workflow filename: `release.yml`
274
+ - Environment: (none)
275
+ - Allowed action: `npm publish`