1.1.0 • Published 5 years ago

typescript-doctest v1.1.0

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

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 and import(...) call resolution from within the doc tests by using the TypeScript Compiler; respecting any custom baseUrl or paths 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 a dev-dependency in your project for the typeoc integration to work.

Example

See the included example project for a basic setup.

Usage

  1. Set the language of your documentation codeblocks to typescript doctest
  2. Run ts-doctest PROJECT_DIR TEST_DIR
  3. Invoke your test runner

License

Licensed under either of