@spec-validator/doc-tester v0.13.0
@spec-validator/doc-tester
Internally extracts typescript code from 'ts/typescript
' code
blocks and feeds those to ts-node
. Line mapping is done accordingly
to indicate the locations of the errors within the source
Markdown files.
Run
ỳarn test-docs
Expected Markdown format
To denote a code block just write:
`ts
const foo = 'On a separate line'
`
The blocks can be additionally labeled to avoid definition collisions:
`ts label-one
const foo = 'One'
`
`ts label-two
const foo = 'Another'
`
`ts label-three
const foo = 'Yet Another'
`
this notifies the tool that definition scopes should be different thus
const
collision will not takes place.
In case if the block should not be executed - mark it with a label
starting with #
(useful if execution will yield side-effects).
`ts #ignore
server.serve()
`
Known limitiations
- By design ignores any non typescript blocks.
- By design ignores any non-multiline blocks (i.e. triple quotes must live on their own lines).
- Works only with triple quote blocks.
<code>
blocks are ignored. - Does not affest Jest's code coverage in any way
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago