4 ms·
Hey HN. This is a small but useful library for writing tests using JSDoc. For example you can write: /** * Returns the sum of 2 numbers * * @exampl
by kiwicopple 7y ago
Hey HN. This is a small but useful library for writing tests using JSDoc.
For example you can write:
/**
* Returns the sum of 2 numbers
*
* @example sum(1, 2)
* //=> 3
*/
export const sum = (a, b) => {
return a + b
}
And then this library will assert that the @example returns the correct code.
This has been super useful for us because it is cognitively easier to write/run the tests in the context of the function itself.
It's not very well tested with classes, but we are looking for any feedback and will continue to improve.