@wdio/spec-reporter
Version:
A WebdriverIO plugin to report in spec style
189 lines (150 loc) • 3.72 kB
Markdown
WDIO Spec Reporter
==================
> A WebdriverIO plugin to report in spec style.

The easiest way is to keep `@wdio/spec-reporter` as a devDependency in your `package.json`, via:
```sh
npm install @wdio/spec-reporter --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here](https://webdriver.io/docs/gettingstarted).
The following code shows the default wdio test runner configuration. Just add `'spec'` as a reporter
to the array.
```js
// wdio.conf.js
module.exports = {
// ...
reporters: ['dot', 'spec'],
// ...
};
```
Provide custom symbols for `passed`, `failed` and or `skipped` tests
Type: `object`
Default: `{passed: '✓', skipped: '-', failed: '✖'}`
```js
[
"spec",
{
symbols: {
passed: '[PASS]',
failed: '[FAIL]',
},
},
]
```
By default the test results in Sauce Labs can only be viewed by a team member from the same team, not by a team member
from a different team. This options will enable [sharable links](https://docs.saucelabs.com/test-results/sharing-test-results/#building-sharable-links)
by default, which means that all tests that are executed in Sauce Labs can be viewed by everybody.
Just add `sauceLabsSharableLinks: false`, as shown below, in the reporter options to disable this feature.
Type: `boolean`
Default: `true`
```js
[
"spec",
{
sauceLabsSharableLinks: false,
},
]
```
Print only failed specs results.
Type: `boolean`
Default: `false`
```js
[
"spec",
{
onlyFailures: true,
},
]
```
Set to `true` to show console logs from steps in final report
Type: `boolean`
Default: `false`
```js
[
"spec",
{
addConsoleLogs: true,
},
]
```
Set to `true` to display test status realtime than just at the end of the run
Type: `boolean`
Default: `false`
```js
[
"spec",
{
realtimeReporting: true,
},
]
```
Set to `false` to disable `[ MutliRemoteBrowser ... ]` preface in the reports.
Type: `boolean`
Default: `true`
```js
[
"spec",
{
showPreface: false,
},
]
```
With it set to `false` you will see output as:
```
Running: loremipsum (v50) on Windows 10
Session ID: foobar
» foo/bar/loo.e2e.js
Foo test
green ✓ foo
green ✓ bar
» bar/foo/loo.e2e.js
Bar test
green ✓ some test
red ✖ a failed test
red ✖ a failed test with no stack
```
and with `true` (default) each line will be prefixed with the preface:
```
[] Running: loremipsum (v50) on Windows 10
[] Session ID: foobar
[]
[] » foo/bar/loo.e2e.js
[] Foo test
[] green ✓ foo
[] green ✓ bar
[]
[] » bar/foo/loo.e2e.js
[] Bar test
[] green ✓ some test
[] red ✖ a failed test
[] red ✖ a failed test with no stack
[]
```
Set to `true` to display colored output in terminal
Type: `boolean`
Default: `true`
```js
[
"spec",
{
color: true,
},
]
```
There are certain options you can set through environment variables:
If set to true, e.g. via `FORCE_COLOR=0 npx wdio run wdio.conf.js`, all terminal coloring will be disabled.