Doctests using JSDoc examples and node-tap.
npm i -D jsdoctap
I recommend adding it to your npm scripts. Example:
@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*/