:earth_americas: Seamless node and browser unit testing with code coverage
Seamless node and browser unit testing with code coverage
Usage: unitest {OPTIONS}
Options:
--version, -v Print version and exit
--help, -h Print usage information
--node, -n Path to node test entry file
--browser, -c Path to browser test entry file
unitest
, specifying test entry filesbabel src -d build
browserify build/test/browser.js > build/test/browser-bundle.js
unitest --browser=build/test/browser-bundle.js --node=build/test/node.js
Unitest works with nyc
, the Istanbul CLI. To run unitest with coverage, add the Istanbul instrumentation Babel plugin then run unitest with nyc on the instrumented code:
babel src -d build --plugins=istanbul
browserify build/test/browser.js > build/test/browser-bundle.js
nyc --report=html unitest --browser=build/test/browser-bundle.js --node=build/test/node.js
The separate TAP and coverage output along with exit code for your node and browser tests will be merged seamlessly.
No magic here, just use plain node.
node --inspect-brk build/test/node.js
Coming soon: ability to launch Chrome with a DevTools window open, or let you connect to the script URL manually.