Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

jsdoc-tests

testkits461MIT1.2.1TypeScript support: included

A JSDoc test tool for documentation-driven quality

documentation-driven quality, jsdoc-test, jsdoc-tests, jest, testing-tool, testing, jsdoc

readme

jsdoc-tests

Node CI npm version

A JSDoc test tool for documentation-driven quality, support async function and export module(ES module/CommonJS).

Installation

yarn add -D jsdoc-tests # npm install -D jsdoc-tests

Usage

  • Create A source code in ./src/example.ts with JSDoc.
/**
 * Two numbers added together
 *
 * @param a {number}
 * @param b {number}
 *
 * @example
 *
 * ```ts
 * import { add } from './src/example';
 *
 * expect(add(1, 2)).toBe(3);
 * ```
 */
export const add = (a: number, b: number) => {
  return a + b;
};
  • Create a test code in ./test/index.test.ts.
import { jsdocTests } from 'jsdoc-tests';

test('test "add" function', () => {
  jsdocTests('./src/example.ts');
});

License

jsdoc-tests is MIT licensed.