WebpackJsdomTapePlugin
install
$ npm install --save-dev webpack-jsdom-tape-plugin
import
api
func WebpackJsdomTapePlugin({ string: url, string: entry, bool: exit = true, bool: errorsOnly = false})
creates a test runner for when the given entry
, at the given url
.
when the test is done, process exits with 0 if passed, and 1 if any errors occured.
exit
option allow you to change this behavior of this plugin.
Note that using exit: false
might introduce a memory leak since jsdom might
not clean everything properly.
errorsOnly
option allow to only show tests on error allowing clean ouput.
test example
// tape is included as a global
integration example
You will need a webpack entry that require all tests files and an html file that will include this entry
src/tests.js
// where you might need to use webpack file-loader for the following html file // you may need to include your polyfill here// eg: import "babel/polyfills" var context = require context
src/tests.html
TestsTAP
es6 webpack.config.js
//... // ... plugins: