Automate TAP browser unit tests with WebDriver
Easily run TAP-producing JS unit tests in the browser, automated by WebDriver with Node.js. This is a helper module for wd-tap, this module sets up the test page and HTTP server for you (using serve-script).
The browser you are testing must have access to
localhost, either running
locally or through a tunnel.
var runner = require'wd-tap-runner'wd = require'wd'browserify = require'browserify';var myCode = browserifyadd'./test.js'bundlebrowser = wdremote;browserinitrunnersrc browser port: 8000// results is parsed using tap-parserbrowserquit;;;
Runs the tests in the browser. The browser must have access to
either run the browser locally or open a tunnel to the remote browser.
src may be a stream or string of JS code that contains the tests that will
be run. The JS code may output TAP output to the web browser console using
console.log(line). The test page automatically displays the console output in
browser is the WebDriver browser (created by
wd) that the tests will be run in.
options is an optional object that may include the following:
port: The port the HTTP server will use
timeout: The timeout for the tests (in seconds). See the wd-tap documentation.
serverTimeout: The timeout for HTTP connections to the server. Default 2000 (milliseconds).
callback will be called with either an error or the TAP test results, parsed
using tap-parser. Note that the error
will be null even if some tests failed; the results indicate what tests passed