tape-results
v0.2.2
Published
Get the tap output from the browser to your console, and exit with an appropriate exit code
Downloads
8
Readme
tape-results
Get the tap output from the browser to your console, and exit with an appropriate exit code
Like smokestack but it allows you to write your own server code.
example
browser-test.js
var test = require('tape')
var results = require('tape-results')
results(test)
test('thing', function (t) {
t.pass('hi')
t.end()
})
server.js
var results = require('tape-results')
var ecstatic = require('ecstatic')
var server = results()
var requestHandler = ecstatic(__dirname + '/public' )
server.on('request', requestHandler)
var addr = server.address()
console.log('Server listening on ' + addr.address + ':' addr.port)
api
var results = require('tape-results')
results(tape)
(Client-side)
Just pass it test
from var test = require('tape')
.
results([server])
(Server-side)
If you don't supply a server, it will create a server on a random port, and return it.
The server
object returned is an http.Server
instance.
When tape is finished on the browser, server.close()
and process.exit()
are called.
travis
When using with travis, you have to use firefox and xvfb.
Add this to your .travis.yml
file:
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
Then, in your server code, add this:
var launch = require('opener')
launch('http://localhost:' + port + '/')
install
With npm do:
npm install tape-results