✅ Assert README example results
Assign every documented matcher result to a variable and assert it with `assert.equal`, so the compiled README doc-tests verify behavior instead of merely running the code. The examples import `node:assert` themselves to stay copy-pasteable; the generator now merges that import into its prelude assert rather than rejecting it (only `node:test` remains reserved).
This commit is contained in:
1 parent
30d97a9209
commit
d0dd8641f2
3 files changed
+35
-13
No files matched your search
+3
-2
@@ -38,8 +38,9 @@ Compile every `ts / `typescript fence in the prose docs into a real
|
||||
`docs/` + `examples/` list is the natural extension; `development/` must never
|
||||
be scanned (its fences are illustrative, not compilable).
|
||||
- The generator hoists and merges leading imports, rewrites `tiny-pattern-ts` to
|
||||
the `#test-tiny-pattern-ts` source alias, and rejects an example that imports
|
||||
`node:assert` / `node:test` (the prelude already binds both). Titles are the
|
||||
the `#test-tiny-pattern-ts` source alias, merges an example's `node:assert`
|
||||
import into the prelude assert, and rejects an example that imports
|
||||
`node:test` (the prelude binds `test`). Titles are the
|
||||
immediately preceding paragraph; a fence with no such paragraph is a fatal
|
||||
error, which keeps every example described.
|
||||
- `oxlint src/doc-test` reports "No files found" because the generated
|
||||
|
||||
Reference in new issue
Block a user