Overview
Type definitions for the WebdriverIO spec reporter including configuration options, test state enums, symbol customization, and test link metadata.
Description
This module exports a comprehensive set of interfaces and enums that define the data structures used by the spec reporter. The SpecReporterOptions interface provides configuration for Sauce Labs sharable links, custom symbols, filtering to only show failures, console log inclusion, real-time reporting, preface visibility, and colored output. The StateCount and Symbols interfaces define counters and display characters for each test state. The State enum enumerates the five possible test outcomes (FAILED, PASSED, PENDING, SKIPPED, RETRIED), while ChalkColors enumerates available terminal color names. The TestLink interface captures the capability, session, and multiremote metadata needed to generate Sauce Labs test result URLs.
Usage
Use these types when extending or configuring the spec reporter. They are consumed internally by the spec reporter class and are available for custom reporter implementations that build on top of the spec reporter's data model.
Code Reference
Source Location
Signature
export interface StateCount {
passed: number
failed: number
skipped: number
pending: number
retried: number
}
export interface Symbols {
passed: string
skipped: string
pending: string
failed: string
retried: string
}
export interface SpecReporterOptions {
sauceLabsSharableLinks?: boolean
symbols?: Partial<Symbols>
onlyFailures?: boolean
addConsoleLogs?: boolean
realtimeReporting?: boolean
showPreface?: boolean
color?: boolean
}
export enum ChalkColors {
RED = 'red',
GREEN = 'green',
CYAN = 'cyan',
GRAY = 'gray',
GREY = 'grey',
BLACCK = 'black',
YELLOW = 'yellow',
BLUE = 'blue',
MAGENTA = 'magenta',
WHITE = 'white',
}
export enum State {
FAILED = 'failed',
PASSED = 'passed',
PENDING = 'pending',
SKIPPED = 'skipped',
RETRIED = 'retried'
}
export interface TestLink {
capabilities: Capabilities.ResolvedTestrunnerCapabilities
sessionId: string
isMultiremote: boolean
instanceName?: string
}
Import
import type {
StateCount,
Symbols,
SpecReporterOptions,
TestLink,
ChalkColors,
State
} from '@wdio/spec-reporter/types'
I/O Contract
Inputs
| Name |
Type |
Required |
Description
|
| sauceLabsSharableLinks |
boolean |
No |
Enable sharable Sauce Labs test result links (default: true)
|
| symbols |
Partial<Symbols> |
No |
Custom symbols for test states (default: passed=✓, failed=✖, skipped=-)
|
| onlyFailures |
boolean |
No |
Show only failed spec results (default: false)
|
| addConsoleLogs |
boolean |
No |
Include console logs from test steps (default: false)
|
| realtimeReporting |
boolean |
No |
Show test status in real time (default: false)
|
| showPreface |
boolean |
No |
Show or hide the [MultiRemote ...] preface on each line (default: true)
|
| color |
boolean |
No |
Enable or disable colored terminal output (default: true)
|
Outputs
| Name |
Type |
Description
|
| SpecReporterOptions |
interface |
Configuration consumed by the spec reporter constructor
|
| StateCount |
interface |
Test result counters for passed, failed, skipped, pending, and retried
|
| Symbols |
interface |
Display characters for each test state
|
| TestLink |
interface |
Metadata for generating Sauce Labs test result URLs
|
| State |
enum |
Enumeration of five possible test outcomes
|
| ChalkColors |
enum |
Enumeration of available chalk terminal color names
|
Enum Details
State
| Member |
Value |
Description
|
| FAILED |
'failed' |
Test failed with an error
|
| PASSED |
'passed' |
Test passed successfully
|
| PENDING |
'pending' |
Test is pending (not yet implemented)
|
| SKIPPED |
'skipped' |
Test was skipped
|
| RETRIED |
'retried' |
Test was retried after a failure
|
ChalkColors
| Member |
Value
|
| RED |
'red'
|
| GREEN |
'green'
|
| CYAN |
'cyan'
|
| GRAY |
'gray'
|
| GREY |
'grey'
|
| BLACCK |
'black'
|
| YELLOW |
'yellow'
|
| BLUE |
'blue'
|
| MAGENTA |
'magenta'
|
| WHITE |
'white'
|
Usage Examples
// wdio.conf.ts - configuring the spec reporter
export const config = {
reporters: [
['spec', {
sauceLabsSharableLinks: true,
symbols: { passed: '[PASS]', failed: '[FAIL]' },
onlyFailures: false,
addConsoleLogs: true,
realtimeReporting: true,
color: true
} as SpecReporterOptions]
]
}
Related Pages