-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,46 @@ | ||
# jsdoc-tests | ||
|
||
![Node CI](https://github.com/unadlib/jsdoc-tests/workflows/Node%20CI/badge.svg) | ||
[![npm version](https://badge.fury.io/js/jsdoc-tests.svg)](http://badge.fury.io/js/jsdoc-tests) | ||
|
||
A JSDoc test tool for Documentation-Driven Quality | ||
|
||
## Installation | ||
|
||
```sh | ||
yarn add -D jsdoc-tests # npm install -D jsdoc-tests | ||
``` | ||
|
||
## Usage and Example | ||
|
||
- Create A source code in `./src/example.ts` with JSDoc. | ||
|
||
```ts | ||
/** | ||
* Two numbers added together | ||
* | ||
* @param a {number} | ||
* @param b {number} | ||
* | ||
* @example | ||
* | ||
* ```ts | ||
* const { add } = require('../test/example'); | ||
* | ||
* expect(add(1, 2)).toBe(3); | ||
* ``` | ||
*/ | ||
export const add = (a: number, b: number) => { | ||
return a + b; | ||
} | ||
``` | ||
|
||
- Create a test file | ||
|
||
```ts | ||
import { jsdocTests } from 'jsdoc-tests'; | ||
|
||
test('test add', () => { | ||
jsdocTests('./src/example.ts'); | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters