@luthaf/typescript-doctest
v1.3.0
Published
Doc Test Generator for TypeScript Projects
Downloads
1
Maintainers
Readme
Doc Tests for TypeScript Projects
typescript-doctest
provides a CLI to generate doc tests from your TypeScript documentation.
Installation
npm install -g typescript-doctest
Features
- Generates tests for all codeblocks in your docs that start with
typescript doctest
- Also generates tests for these kind of codeblocks in your
README.md
- Supports
import
statements andimport(...)
call resolution from within the doc tests by using the TypeScript Compiler; respecting any custombaseUrl
orpaths
setup - Allows to hide certain lines from your doc tests in the documentation generated by typedoc by prefixing them with
#
Note: You need to install
typescript-doctest
as adev-dependency
in your project for the typeoc integration to work.
Example
See the included example project for a basic setup.
Usage
- Set the language of your documentation codeblocks to
typescript doctest
- Run
ts-doctest PROJECT_DIR TEST_DIR
- Invoke your test runner
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.