0.5.8 • Published 7 years ago

jsdoctap v0.5.8

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

jsdoctap

Test runner for doctests using JSDoc examples and node-tap.

Based on the hard work of @yamadapc and this project.

screenshot


Installation

npm i -D jsdoctap

Usage

jsdoctap some-file.js

I recommend adding it to your npm scripts. Example:

{
  "scripts": {
    "test": "jsdoctap src/*.js"
  }
}

Options

jsdoctap has one option: -i (or --ignore) Example: jsdoctap -i src/*.test.js -i src/*.config.js src/*.js.

Format

Tests must be under an @example in a valid JSDoc comment. The return value to be tested against must come after a line comment with an arrow (Clojure REPL style):

/**
 * Identity
 * @example
 * id(1) // => 1
 */

Line breaks between the call and the comment are fine:

/**
 * Identity
 * @example
 *   id(1)
 *   // => 1
 */

Line breaks in function calls currently do not work:

/**
 * This will break!
 * @example
 * id(
 *   1
 * ) // => 1
 */

Source and examples that need to be Babelified work just fine, as long as you have Babel configured and modules installed.

Roadmap

  • Handle expecting errors
  • Fix multi-line function calls
  • Fix dependencies that need to be Babelified
  • Add ability to have custom test case name
  • Clean up comment-parser and getModuleName (in tap)
  • More tests and examples

License

MIT

0.5.8

7 years ago

0.5.7

7 years ago

0.5.6

7 years ago

0.5.5

7 years ago

0.5.4

7 years ago

0.5.3

7 years ago

0.5.2

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.16

7 years ago

0.4.15

7 years ago

0.4.14

7 years ago

0.4.13

7 years ago

0.4.12

7 years ago

0.4.11

8 years ago

0.4.10

8 years ago

0.4.9

8 years ago

0.4.8

8 years ago

0.4.7

8 years ago

0.4.6

8 years ago

0.4.5

8 years ago

0.4.4

8 years ago

0.4.3

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.8

8 years ago

0.3.7

8 years ago

0.3.6

8 years ago

0.3.5

8 years ago

0.3.4

8 years ago

0.3.3

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.9

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.1

8 years ago