doc-test
Examples are tests!
Example
Imagine we are writing tests/examples for ready-signal
var Signal =log = __filename/*Signal gives you a signal function.*/// "function"/*You can attach a listener to signalAnd it will be called*/var r =/*It also calls your listener if you add itafter the signal is ready*/var r =/*Multiple callbacks will also fire!*/var r =
Now just run node file.js
and it should print
1 function
2 true
3 true
4 true
5 true
What it's doing is matching every log call with the value descriped in the comment below it. That's it.
This is your test, example and documentation
CLI Usage
npm install doc-test -g
doc-test <relative folder>
This will basically just run node on every file.
Inspiration
Installation
npm install doc-test
Contributors
- Raynos