0
# Configuration
1
2
Core configuration options for customizing reporter behavior, output formatting, and integration features.
3
4
## Capabilities
5
6
### SpecReporterOptions Interface
7
8
Main configuration interface for customizing all aspects of the spec reporter.
9
10
```typescript { .api }
11
/**
12
* Configuration options for SpecReporter
13
*/
14
interface SpecReporterOptions {
15
/**
16
* Enable/disable Sauce Labs sharable links
17
* By default test results in Sauce Labs can only be viewed by team members.
18
* This option enables sharable links that can be viewed by anybody.
19
* @default true
20
*/
21
sauceLabsSharableLinks?: boolean;
22
23
/**
24
* Custom symbols for different test states
25
* @default {passed: '✓', skipped: '-', failed: '✖', pending: '?', retried: '↻'}
26
*/
27
symbols?: Partial<Symbols>;
28
29
/**
30
* Show only failed test results
31
* @default false
32
*/
33
onlyFailures?: boolean;
34
35
/**
36
* Include console logs from steps in report
37
* @default false
38
*/
39
addConsoleLogs?: boolean;
40
41
/**
42
* Enable real-time test status output during execution
43
* @default false
44
*/
45
realtimeReporting?: boolean;
46
47
/**
48
* Show/hide preface on each line ('[MultiRemote ...]')
49
* @default true
50
*/
51
showPreface?: boolean;
52
53
/**
54
* Enable/disable colored terminal output
55
* @default true
56
*/
57
color?: boolean;
58
}
59
```
60
61
**Usage Examples:**
62
63
```typescript
64
import SpecReporter from "@wdio/spec-reporter";
65
66
// Basic configuration
67
const reporter = new SpecReporter({
68
color: true,
69
onlyFailures: false
70
});
71
72
// Advanced configuration with custom symbols
73
const reporter = new SpecReporter({
74
symbols: {
75
passed: '[PASS]',
76
failed: '[FAIL]',
77
skipped: '[SKIP]'
78
},
79
addConsoleLogs: true,
80
realtimeReporting: true,
81
sauceLabsSharableLinks: false
82
});
83
84
// WebdriverIO configuration
85
export const config = {
86
reporters: [
87
['spec', {
88
sauceLabsSharableLinks: true,
89
symbols: {
90
passed: '✅',
91
failed: '❌',
92
skipped: '⏭️'
93
},
94
onlyFailures: false,
95
addConsoleLogs: true,
96
realtimeReporting: false,
97
showPreface: true,
98
color: true
99
}]
100
]
101
};
102
```
103
104
### Symbols Configuration
105
106
Custom symbols for different test states to personalize output appearance.
107
108
```typescript { .api }
109
/**
110
* Custom symbols for different test states
111
*/
112
interface Symbols {
113
/** Symbol for passed tests */
114
passed: string;
115
/** Symbol for skipped tests */
116
skipped: string;
117
/** Symbol for pending tests */
118
pending: string;
119
/** Symbol for failed tests */
120
failed: string;
121
/** Symbol for retried tests */
122
retried: string;
123
}
124
```
125
126
**Usage Examples:**
127
128
```typescript
129
// Unicode symbols
130
const unicodeSymbols = {
131
passed: '✅',
132
failed: '❌',
133
skipped: '⏭️',
134
pending: '⏳',
135
retried: '🔄'
136
};
137
138
// Text-based symbols
139
const textSymbols = {
140
passed: '[PASS]',
141
failed: '[FAIL]',
142
skipped: '[SKIP]',
143
pending: '[PENDING]',
144
retried: '[RETRY]'
145
};
146
147
// Minimal symbols
148
const minimalSymbols = {
149
passed: '+',
150
failed: 'x',
151
skipped: '-'
152
};
153
```
154
155
### Console Integration Options
156
157
Configuration for capturing and displaying console output during test execution.
158
159
```typescript { .api }
160
interface ConsoleOptions {
161
/** Include console logs in report output */
162
addConsoleLogs: boolean;
163
}
164
```
165
166
**Usage Examples:**
167
168
```typescript
169
// Enable console log capture
170
const reporter = new SpecReporter({
171
addConsoleLogs: true
172
});
173
174
// Console logs will appear in test output:
175
// Running: chrome (v91) on macOS Big Sur
176
//
177
// » /tests/example.test.js
178
// Example Test Suite
179
// ✓ should pass test
180
//
181
// .........Console Logs.........
182
// console.log('Debug information')
183
// console.warn('Warning message')
184
```
185
186
### Realtime Reporting Configuration
187
188
Options for enabling live test status updates during execution.
189
190
```typescript { .api }
191
interface RealtimeOptions {
192
/** Enable real-time test status output */
193
realtimeReporting: boolean;
194
}
195
```
196
197
**Usage Examples:**
198
199
```typescript
200
// Enable realtime reporting
201
const reporter = new SpecReporter({
202
realtimeReporting: true
203
});
204
205
// Output will show tests as they execute:
206
// [chrome 91 macOS Big Sur #0-0] ------------------------------------------------------------------
207
// [chrome 91 macOS Big Sur #0-0] Suite started:
208
// [chrome 91 macOS Big Sur #0-0] » /tests/example.test.js
209
// [chrome 91 macOS Big Sur #0-0] ✓ should pass test » [ /tests/example.test.js ]
210
```
211
212
### Environment Variables
213
214
Environment-based configuration options that override settings.
215
216
```typescript { .api }
217
interface EnvironmentConfig {
218
/** Force disable all terminal coloring when set to '0' */
219
FORCE_COLOR?: string;
220
}
221
```
222
223
**Usage Examples:**
224
225
```bash
226
# Disable all colors
227
FORCE_COLOR=0 npx wdio run wdio.conf.js
228
229
# Enable colors (default)
230
FORCE_COLOR=1 npx wdio run wdio.conf.js
231
```