# typescript-doctest

> Doc Test Generator for TypeScript Projects

Latest version **1.1.0** (published 2019-02-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install typescript-doctest
pnpm add typescript-doctest
yarn add typescript-doctest
bun add typescript-doctest
```

Provides the command `ts-doctest`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2019-02-04 |
| First published | 2019-02-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 38.2 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | Ivo Wetzel |
| Maintainers | bonsaiden |
| Keywords | tests, typescript, testing, documentation, doc, typedocplugin, typedoc |

## Links

- npm: https://www.npmjs.com/package/typescript-doctest
- Homepage: https://gitlab.com/BonsaiDen/ts-doctest#readme
- Issues: https://gitlab.com/BonsaiDen/ts-doctest/issues
- npm.io page: https://npm.io/package/typescript-doctest

## Dependencies (3)

- [typedoc](https://npm.io/package/typedoc.md) ^0.14.2
- [typescript](https://npm.io/package/typescript.md) ^3.2.2
- [markdown-it](https://npm.io/package/markdown-it.md) ^8.4.2

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2019-02-04
- 1.0.0 — 2019-02-03

## 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 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](https://typedoc.org) 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](example#readme) 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
 * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
 * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.

---
_Source: https://npm.io/package/typescript-doctest · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
