src/index.js
function fetch (options) {
    var time, promise, resolve, reject;

    time = new Date();
    promise = new Promise(function (r1, r2) { resolve = r1; reject = r2; } );

    try {
        options = normalise(options);

        if (options.resultIds) {
            wpt.getResults(options, options.resultIds).then(after);
        } else {
            wpt.runTests(options).then(wpt.getResults.bind(null, options)).then(after);
        }
    } catch (error) {
        reject(error);
    }

    return promise;

    function after (results) {
        results = {
            data: results,
            options: options,
            times: {
                begin: time,
                end: new Date()
            }
        };

        if (options.dump) {
            dump(options, results);
        }

        resolve(results);
    }
}
function fetch (options) {
    var time, promise, resolve, reject;

    time = new Date();
    promise = new Promise(function (r1, r2) { resolve = r1; reject = r2; } );

    try {
        options = normalise(options);

        if (options.resultIds) {
            wpt.getResults(options, options.resultIds).then(after);
        } else {
            wpt.runTests(options).then(wpt.getResults.bind(null, options)).then(after);
        }
    } catch (error) {
        reject(error);
    }

    return promise;

    function after (results) {
        results = {
            data: results,
            options: options,
            times: {
                begin: time,
                end: new Date()
            }
        };

        if (options.dump) {
            dump(options, results);
        }

        resolve(results);
    }
}
Public function `fetch`.

Invokes WebPageTest, returns an ES6 promise.

@option uri        {string}  Base URI for the WebPageTest instance, defaults to
`www.webpagetest.org`.
@option key        {string}  WebPageTest API key.
@option location   {string}  WebPageTest location, defaults to `Dulles:Chrome`.
@option connection {string}  WebPageTest connection speed, defaults to `Native
Connection`.
@option tests      {string}  Path to the test definitions JSON file, defaults
to `tests.json`.
@option count      {number}  Number of times to run each test, defaults to `9`.
@option email      {string}  Email address to send notifications to.
@option dump       {string}  Dump intermediate results to file.
@option resultIds  {array}   Bypass running the tests and fetch the specified
results instead.
@option silent     {boolean} Disable logging, overrides `syslog` and `log`.
@option syslog     {string}  Send logs to syslog, overrides `log`.
@option log        {object}  Logging implementation, needs `log.info()`,
`log.warn()` and `log.error()`.
@option config     {string}  Load options from JSON config file.