Tap runner for Sauce Labs.
gravyTap
works by taking raw, tap-producing javascript code as a string, running it in real browser via SauceLabs, and providing a summary of the results.
import gravyTap from 'gravy-tap';
import { readFileSync } from 'fs';
import { resolve } from 'path';
const src = readFileSync(resolve(__dirname, 'test/bundle.js'));
gravyTap(src)
.then(results => {
// results include information about the parsed tap output
// see below for explanation
})
.catch(err => {
// if the code lands here, there were probably uncaught errors in the code
// sent to the sauce labs runner
});
src
is your raw, tap-producing javascript code, read from a file or otherwise passed in as a string. options
is an object, described below.
gravyTap
also takes a second parameter that is an object of options. The available options are:
Option | Default | Description |
---|---|---|
rejectOnErrors | true | If there are errors in the tap output, reject the promise |
capabilities | An object of SauceLabs capabilities | |
sauce | The SauceLabs user and key values, as an object ({ user: '...', key: '...' } ); can also be set using SAUCE_USER and SAUCE_KEY environment variables |
The results
object can be used to check the results of the test run.
Property | Description |
---|---|
results.output | Full tap output produced by src |
results.tests | Number of tests executed |
results.passed | Number of tests that passed |
results.failed | Number of tests that failed |
results.errors | An array of all the failed tests, as objects (see below) |
This library uses simple-tap-parser to parse the tap output, see that module for more information.
The objects inside the results.errors
array have the following properties:
Property | Description |
---|---|
line | The failing line's summary |
details | The entire failure message |
MIT © w33ble
Cross-browser Testing Platform and Open Source <3 Provided by Sauce Labs