JSDoc: Class: Runner

# Class: Runner

## reftest.Runner()

#### new Runner()

Source:
  - reftest.js, line 45

### Methods

#### (async) run(testUrl, references, expected, timeout) → {Object}

Run a specific reftest.

The assumed semantics are those of web-platform-tests where references form a tree and each test must meet all the conditions to reach one leaf node of the tree in order for the overall test to pass.

##### Parameters:

Name | Type | Description
--- | --- | ---
`testUrl` | string | URL of the test itself.
`references` | Array.<Array> | Array representing a tree of references to try.
    Each item in the array represents a single reference node and
    has the form <code>[referenceUrl, references, relation]</code>,
    where <var>referenceUrl</var> is a string to the URL, relation
    is either <code>==</code> or <code>!=</code> depending on the
    type of reftest, and references is another array containing
    items of the same form, representing further comparisons treated
    as AND with the current item. Sibling entries are treated as OR.

    For example with testUrl of T:

    <pre><code>
      references = [[A, [[B, [], ==]], ==]]
      Must have T == A AND A == B to pass

      references = [[A, [], ==], [B, [], !=]
      Must have T == A OR T != B

      references = [[A, [[B, [], ==], [C, [], ==]], ==], [D, [], ]]
      Must have (T == A AND A == B) OR (T == A AND A == C) OR (T == D)
    </code></pre>
`expected` | string | Expected test outcome (e.g. `PASS`, `FAIL`).
`timeout` | number | Test timeout in milliseconds.

Source:
  - reftest.js, line 185

##### Returns:

Result object with fields status, message and extra.

Type
  Object

#### (async) setup(urlCount, screenshotMode)

Setup the required environment for running reftests.

This will open a non-browser window in which the tests will be loaded, and set up various caches for the reftest run.

##### Parameters:

Name | Type | Description
--- | --- | ---
`urlCount` | Object.<Number> | Object holding a map of URL: number of times the URL will be opened during the reftest run, where that's greater than 1.
`screenshotMode` | string | String enum representing when screenshots should be taken

Source:
  - reftest.js, line 71