typescript-doctest
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

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

Package Sidebar

Install

npm i typescript-doctest

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

39.1 kB

Total Files

27

Last publish

Collaborators

  • bonsaiden