wd-tap-runner
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).
Example
The browser you are testing must have access to localhost
, either running
locally or through a tunnel.
var runner = wd = browserify = ; var myCode = browser = wd; browser;
Reference
runner(src, browser, [options], callback)
Runs the tests in the browser. The browser must have access to localhost
,
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
the document.
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 usetimeout
: 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
or failed.