♻️ Run doc tests outside the coverage gate
An example that exercises a line no hand-written test reaches would let the `--100` gate pass on documentation alone. Node has no file-level exclusion, and c8's `--exclude` only filters the report, so run the two in separate processes: `test:coverage` runs c8 over the tracked tests only (`git ls-files`, which skips the untracked generated files), and `test:doc` runs the generated examples without c8. `test:ci` chains them.
This commit is contained in:
1 parent
a9b588e1c3
commit
4dc58395c0
3 files changed
+12
-3
No files matched your search
@@ -49,3 +49,9 @@ Compile every `ts / `typescript fence in the prose docs into a real
|
||||
out of the `--100` gate. Do not add an `--exclude` for them: passing any
|
||||
`--exclude` replaces the defaults, so every hand-written test file and
|
||||
`__tests__/` helper re-enters coverage and the gate fails.
|
||||
- Generated examples must not run under `c8`: an example could cover a line no
|
||||
hand-written test reaches, so the coverage gate would pass on documentation
|
||||
alone. `test:coverage` therefore runs c8 over the tracked tests only
|
||||
(`git ls-files 'src/*.test.ts'` — the generated files are untracked), and
|
||||
`test:doc` runs the examples in a separate process without c8. `test:ci`
|
||||
chains the two, so correctness and coverage stay independent.
|
||||
Reference in new issue
Block a user