@japa/runner 3.0.0-9 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/cli_parser.js +2 -2
- package/build/src/config_manager.js +2 -2
- package/build/src/types.d.ts +1 -1
- package/package.json +17 -13
- package/build/examples/dot.d.ts +0 -1
- package/build/examples/dot.js +0 -11
- package/build/examples/ndjson.d.ts +0 -1
- package/build/examples/ndjson.js +0 -11
- package/build/examples/spec.d.ts +0 -1
- package/build/examples/spec.js +0 -11
- package/build/tests/base_reporter.spec.d.ts +0 -1
- package/build/tests/base_reporter.spec.js +0 -111
- package/build/tests/cli_parser.spec.d.ts +0 -1
- package/build/tests/cli_parser.spec.js +0 -265
- package/build/tests/config_manager.spec.d.ts +0 -1
- package/build/tests/config_manager.spec.js +0 -741
- package/build/tests/core.spec.d.ts +0 -1
- package/build/tests/core.spec.js +0 -31
- package/build/tests/files_manager.spec.d.ts +0 -1
- package/build/tests/files_manager.spec.js +0 -153
- package/build/tests/planner.spec.d.ts +0 -1
- package/build/tests/planner.spec.js +0 -510
- package/build/tests/runner.spec.d.ts +0 -1
- package/build/tests/runner.spec.js +0 -442
- package/build/tests_helpers/main.d.ts +0 -7
- package/build/tests_helpers/main.js +0 -34
|
@@ -1,510 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @japa/runner
|
|
3
|
-
*
|
|
4
|
-
* (c) Japa
|
|
5
|
-
*
|
|
6
|
-
* For the full copyright and license information, please view the LICENSE
|
|
7
|
-
* file that was distributed with this source code.
|
|
8
|
-
*/
|
|
9
|
-
import { assert } from 'chai';
|
|
10
|
-
import { test } from 'node:test';
|
|
11
|
-
import { Planner } from '../src/planner.js';
|
|
12
|
-
import { ConfigManager, NOOP } from '../src/config_manager.js';
|
|
13
|
-
import { wrapAssertions } from '../tests_helpers/main.js';
|
|
14
|
-
test.describe('Planner | files', () => {
|
|
15
|
-
test('get suites for files', async () => {
|
|
16
|
-
const config = new ConfigManager({ files: ['tests/**/*.spec.ts'] }, {}).hydrate();
|
|
17
|
-
const { suites } = await new Planner(config).plan();
|
|
18
|
-
await wrapAssertions(() => {
|
|
19
|
-
assert.deepEqual(suites, [
|
|
20
|
-
{
|
|
21
|
-
name: 'default',
|
|
22
|
-
files: ['tests/**/*.spec.ts'],
|
|
23
|
-
filesURLs: [
|
|
24
|
-
new URL('../tests/base_reporter.spec.ts', import.meta.url),
|
|
25
|
-
new URL('../tests/cli_parser.spec.ts', import.meta.url),
|
|
26
|
-
new URL('../tests/config_manager.spec.ts', import.meta.url),
|
|
27
|
-
new URL('../tests/core.spec.ts', import.meta.url),
|
|
28
|
-
new URL('../tests/files_manager.spec.ts', import.meta.url),
|
|
29
|
-
new URL('../tests/planner.spec.ts', import.meta.url),
|
|
30
|
-
new URL('../tests/runner.spec.ts', import.meta.url),
|
|
31
|
-
],
|
|
32
|
-
retries: 0,
|
|
33
|
-
timeout: 2000,
|
|
34
|
-
},
|
|
35
|
-
]);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
test('apply files filter to the list', async () => {
|
|
39
|
-
const config = new ConfigManager({ files: ['tests/**/*.spec.ts'], filters: { files: ['parser'] } }, {}).hydrate();
|
|
40
|
-
const { suites } = await new Planner(config).plan();
|
|
41
|
-
await wrapAssertions(() => {
|
|
42
|
-
assert.deepEqual(suites, [
|
|
43
|
-
{
|
|
44
|
-
name: 'default',
|
|
45
|
-
files: ['tests/**/*.spec.ts'],
|
|
46
|
-
filesURLs: [new URL('../tests/cli_parser.spec.ts', import.meta.url)],
|
|
47
|
-
retries: 0,
|
|
48
|
-
timeout: 2000,
|
|
49
|
-
},
|
|
50
|
-
]);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
test('use inline global timeout', async () => {
|
|
54
|
-
const config = new ConfigManager({ files: ['tests/**/*.spec.ts'], timeout: 1000 }, {}).hydrate();
|
|
55
|
-
const { suites } = await new Planner(config).plan();
|
|
56
|
-
await wrapAssertions(() => {
|
|
57
|
-
assert.deepEqual(suites, [
|
|
58
|
-
{
|
|
59
|
-
name: 'default',
|
|
60
|
-
files: ['tests/**/*.spec.ts'],
|
|
61
|
-
filesURLs: [
|
|
62
|
-
new URL('../tests/base_reporter.spec.ts', import.meta.url),
|
|
63
|
-
new URL('../tests/cli_parser.spec.ts', import.meta.url),
|
|
64
|
-
new URL('../tests/config_manager.spec.ts', import.meta.url),
|
|
65
|
-
new URL('../tests/core.spec.ts', import.meta.url),
|
|
66
|
-
new URL('../tests/files_manager.spec.ts', import.meta.url),
|
|
67
|
-
new URL('../tests/planner.spec.ts', import.meta.url),
|
|
68
|
-
new URL('../tests/runner.spec.ts', import.meta.url),
|
|
69
|
-
],
|
|
70
|
-
retries: 0,
|
|
71
|
-
timeout: 1000,
|
|
72
|
-
},
|
|
73
|
-
]);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
test('use cli timeout', async () => {
|
|
77
|
-
const config = new ConfigManager({ files: ['tests/**/*.spec.ts'], timeout: 1000 }, {
|
|
78
|
-
timeout: '3000',
|
|
79
|
-
}).hydrate();
|
|
80
|
-
const { suites } = await new Planner(config).plan();
|
|
81
|
-
await wrapAssertions(() => {
|
|
82
|
-
assert.deepEqual(suites, [
|
|
83
|
-
{
|
|
84
|
-
name: 'default',
|
|
85
|
-
files: ['tests/**/*.spec.ts'],
|
|
86
|
-
filesURLs: [
|
|
87
|
-
new URL('../tests/base_reporter.spec.ts', import.meta.url),
|
|
88
|
-
new URL('../tests/cli_parser.spec.ts', import.meta.url),
|
|
89
|
-
new URL('../tests/config_manager.spec.ts', import.meta.url),
|
|
90
|
-
new URL('../tests/core.spec.ts', import.meta.url),
|
|
91
|
-
new URL('../tests/files_manager.spec.ts', import.meta.url),
|
|
92
|
-
new URL('../tests/planner.spec.ts', import.meta.url),
|
|
93
|
-
new URL('../tests/runner.spec.ts', import.meta.url),
|
|
94
|
-
],
|
|
95
|
-
retries: 0,
|
|
96
|
-
timeout: 3000,
|
|
97
|
-
},
|
|
98
|
-
]);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
test('use inline global retries', async () => {
|
|
102
|
-
const config = new ConfigManager({ files: ['tests/**/*.spec.ts'], retries: 2 }, {}).hydrate();
|
|
103
|
-
const { suites } = await new Planner(config).plan();
|
|
104
|
-
await wrapAssertions(() => {
|
|
105
|
-
assert.deepEqual(suites, [
|
|
106
|
-
{
|
|
107
|
-
name: 'default',
|
|
108
|
-
files: ['tests/**/*.spec.ts'],
|
|
109
|
-
filesURLs: [
|
|
110
|
-
new URL('../tests/base_reporter.spec.ts', import.meta.url),
|
|
111
|
-
new URL('../tests/cli_parser.spec.ts', import.meta.url),
|
|
112
|
-
new URL('../tests/config_manager.spec.ts', import.meta.url),
|
|
113
|
-
new URL('../tests/core.spec.ts', import.meta.url),
|
|
114
|
-
new URL('../tests/files_manager.spec.ts', import.meta.url),
|
|
115
|
-
new URL('../tests/planner.spec.ts', import.meta.url),
|
|
116
|
-
new URL('../tests/runner.spec.ts', import.meta.url),
|
|
117
|
-
],
|
|
118
|
-
retries: 2,
|
|
119
|
-
timeout: 2000,
|
|
120
|
-
},
|
|
121
|
-
]);
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
test('use cli retries', async () => {
|
|
125
|
-
const config = new ConfigManager({ files: ['tests/**/*.spec.ts'], retries: 2 }, {
|
|
126
|
-
retries: '3',
|
|
127
|
-
}).hydrate();
|
|
128
|
-
const { suites } = await new Planner(config).plan();
|
|
129
|
-
await wrapAssertions(() => {
|
|
130
|
-
assert.deepEqual(suites, [
|
|
131
|
-
{
|
|
132
|
-
name: 'default',
|
|
133
|
-
files: ['tests/**/*.spec.ts'],
|
|
134
|
-
filesURLs: [
|
|
135
|
-
new URL('../tests/base_reporter.spec.ts', import.meta.url),
|
|
136
|
-
new URL('../tests/cli_parser.spec.ts', import.meta.url),
|
|
137
|
-
new URL('../tests/config_manager.spec.ts', import.meta.url),
|
|
138
|
-
new URL('../tests/core.spec.ts', import.meta.url),
|
|
139
|
-
new URL('../tests/files_manager.spec.ts', import.meta.url),
|
|
140
|
-
new URL('../tests/planner.spec.ts', import.meta.url),
|
|
141
|
-
new URL('../tests/runner.spec.ts', import.meta.url),
|
|
142
|
-
],
|
|
143
|
-
retries: 3,
|
|
144
|
-
timeout: 2000,
|
|
145
|
-
},
|
|
146
|
-
]);
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
test('error when suite filter is applied with files', async () => {
|
|
150
|
-
const config = new ConfigManager({
|
|
151
|
-
files: [],
|
|
152
|
-
}, {
|
|
153
|
-
_: ['functional'],
|
|
154
|
-
}).hydrate();
|
|
155
|
-
await wrapAssertions(() => {
|
|
156
|
-
assert.throws(() => new Planner(config), 'Cannot apply suites filter. You have not configured any test suites');
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
test.describe('Planner | suites', () => {
|
|
161
|
-
test('get suites', async () => {
|
|
162
|
-
const config = new ConfigManager({ suites: [{ name: 'unit', files: 'tests/**/*.spec.ts' }] }, {}).hydrate();
|
|
163
|
-
const { suites } = await new Planner(config).plan();
|
|
164
|
-
await wrapAssertions(() => {
|
|
165
|
-
assert.deepEqual(suites, [
|
|
166
|
-
{
|
|
167
|
-
name: 'unit',
|
|
168
|
-
files: 'tests/**/*.spec.ts',
|
|
169
|
-
filesURLs: [
|
|
170
|
-
new URL('../tests/base_reporter.spec.ts', import.meta.url),
|
|
171
|
-
new URL('../tests/cli_parser.spec.ts', import.meta.url),
|
|
172
|
-
new URL('../tests/config_manager.spec.ts', import.meta.url),
|
|
173
|
-
new URL('../tests/core.spec.ts', import.meta.url),
|
|
174
|
-
new URL('../tests/files_manager.spec.ts', import.meta.url),
|
|
175
|
-
new URL('../tests/planner.spec.ts', import.meta.url),
|
|
176
|
-
new URL('../tests/runner.spec.ts', import.meta.url),
|
|
177
|
-
],
|
|
178
|
-
retries: 0,
|
|
179
|
-
timeout: 2000,
|
|
180
|
-
configure: NOOP,
|
|
181
|
-
},
|
|
182
|
-
]);
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
test('apply files filter to the suites', async () => {
|
|
186
|
-
const config = new ConfigManager({ suites: [{ name: 'unit', files: 'tests/**/*.spec.ts' }], filters: { files: ['manager'] } }, {}).hydrate();
|
|
187
|
-
const { suites } = await new Planner(config).plan();
|
|
188
|
-
await wrapAssertions(() => {
|
|
189
|
-
assert.deepEqual(suites, [
|
|
190
|
-
{
|
|
191
|
-
name: 'unit',
|
|
192
|
-
files: 'tests/**/*.spec.ts',
|
|
193
|
-
filesURLs: [
|
|
194
|
-
new URL('../tests/config_manager.spec.ts', import.meta.url),
|
|
195
|
-
new URL('../tests/files_manager.spec.ts', import.meta.url),
|
|
196
|
-
],
|
|
197
|
-
retries: 0,
|
|
198
|
-
timeout: 2000,
|
|
199
|
-
configure: NOOP,
|
|
200
|
-
},
|
|
201
|
-
]);
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
test('use inline timeout', async () => {
|
|
205
|
-
const config = new ConfigManager({
|
|
206
|
-
suites: [{ name: 'unit', files: 'tests/**/*.spec.ts', timeout: 1000 }],
|
|
207
|
-
}, {}).hydrate();
|
|
208
|
-
const { suites } = await new Planner(config).plan();
|
|
209
|
-
await wrapAssertions(() => {
|
|
210
|
-
assert.deepEqual(suites, [
|
|
211
|
-
{
|
|
212
|
-
name: 'unit',
|
|
213
|
-
files: 'tests/**/*.spec.ts',
|
|
214
|
-
filesURLs: [
|
|
215
|
-
new URL('../tests/base_reporter.spec.ts', import.meta.url),
|
|
216
|
-
new URL('../tests/cli_parser.spec.ts', import.meta.url),
|
|
217
|
-
new URL('../tests/config_manager.spec.ts', import.meta.url),
|
|
218
|
-
new URL('../tests/core.spec.ts', import.meta.url),
|
|
219
|
-
new URL('../tests/files_manager.spec.ts', import.meta.url),
|
|
220
|
-
new URL('../tests/planner.spec.ts', import.meta.url),
|
|
221
|
-
new URL('../tests/runner.spec.ts', import.meta.url),
|
|
222
|
-
],
|
|
223
|
-
retries: 0,
|
|
224
|
-
timeout: 1000,
|
|
225
|
-
configure: NOOP,
|
|
226
|
-
},
|
|
227
|
-
]);
|
|
228
|
-
});
|
|
229
|
-
});
|
|
230
|
-
test('use cli timeout', async () => {
|
|
231
|
-
const config = new ConfigManager({ suites: [{ name: 'unit', files: 'tests/**/*.spec.ts', timeout: 1000 }] }, {
|
|
232
|
-
timeout: '3000',
|
|
233
|
-
}).hydrate();
|
|
234
|
-
const { suites } = await new Planner(config).plan();
|
|
235
|
-
await wrapAssertions(() => {
|
|
236
|
-
assert.deepEqual(suites, [
|
|
237
|
-
{
|
|
238
|
-
name: 'unit',
|
|
239
|
-
files: 'tests/**/*.spec.ts',
|
|
240
|
-
filesURLs: [
|
|
241
|
-
new URL('../tests/base_reporter.spec.ts', import.meta.url),
|
|
242
|
-
new URL('../tests/cli_parser.spec.ts', import.meta.url),
|
|
243
|
-
new URL('../tests/config_manager.spec.ts', import.meta.url),
|
|
244
|
-
new URL('../tests/core.spec.ts', import.meta.url),
|
|
245
|
-
new URL('../tests/files_manager.spec.ts', import.meta.url),
|
|
246
|
-
new URL('../tests/planner.spec.ts', import.meta.url),
|
|
247
|
-
new URL('../tests/runner.spec.ts', import.meta.url),
|
|
248
|
-
],
|
|
249
|
-
retries: 0,
|
|
250
|
-
timeout: 3000,
|
|
251
|
-
configure: NOOP,
|
|
252
|
-
},
|
|
253
|
-
]);
|
|
254
|
-
});
|
|
255
|
-
});
|
|
256
|
-
test('use inline retries', async () => {
|
|
257
|
-
const config = new ConfigManager({ suites: [{ name: 'unit', files: 'tests/**/*.spec.ts', retries: 2 }] }, {}).hydrate();
|
|
258
|
-
const { suites } = await new Planner(config).plan();
|
|
259
|
-
await wrapAssertions(() => {
|
|
260
|
-
assert.deepEqual(suites, [
|
|
261
|
-
{
|
|
262
|
-
name: 'unit',
|
|
263
|
-
files: 'tests/**/*.spec.ts',
|
|
264
|
-
filesURLs: [
|
|
265
|
-
new URL('../tests/base_reporter.spec.ts', import.meta.url),
|
|
266
|
-
new URL('../tests/cli_parser.spec.ts', import.meta.url),
|
|
267
|
-
new URL('../tests/config_manager.spec.ts', import.meta.url),
|
|
268
|
-
new URL('../tests/core.spec.ts', import.meta.url),
|
|
269
|
-
new URL('../tests/files_manager.spec.ts', import.meta.url),
|
|
270
|
-
new URL('../tests/planner.spec.ts', import.meta.url),
|
|
271
|
-
new URL('../tests/runner.spec.ts', import.meta.url),
|
|
272
|
-
],
|
|
273
|
-
retries: 2,
|
|
274
|
-
timeout: 2000,
|
|
275
|
-
configure: NOOP,
|
|
276
|
-
},
|
|
277
|
-
]);
|
|
278
|
-
});
|
|
279
|
-
});
|
|
280
|
-
test('use cli retries', async () => {
|
|
281
|
-
const config = new ConfigManager({ suites: [{ name: 'unit', files: 'tests/**/*.spec.ts', retries: 2 }] }, { retries: '3' }).hydrate();
|
|
282
|
-
const { suites } = await new Planner(config).plan();
|
|
283
|
-
await wrapAssertions(() => {
|
|
284
|
-
assert.deepEqual(suites, [
|
|
285
|
-
{
|
|
286
|
-
name: 'unit',
|
|
287
|
-
files: 'tests/**/*.spec.ts',
|
|
288
|
-
filesURLs: [
|
|
289
|
-
new URL('../tests/base_reporter.spec.ts', import.meta.url),
|
|
290
|
-
new URL('../tests/cli_parser.spec.ts', import.meta.url),
|
|
291
|
-
new URL('../tests/config_manager.spec.ts', import.meta.url),
|
|
292
|
-
new URL('../tests/core.spec.ts', import.meta.url),
|
|
293
|
-
new URL('../tests/files_manager.spec.ts', import.meta.url),
|
|
294
|
-
new URL('../tests/planner.spec.ts', import.meta.url),
|
|
295
|
-
new URL('../tests/runner.spec.ts', import.meta.url),
|
|
296
|
-
],
|
|
297
|
-
retries: 3,
|
|
298
|
-
timeout: 2000,
|
|
299
|
-
configure: NOOP,
|
|
300
|
-
},
|
|
301
|
-
]);
|
|
302
|
-
});
|
|
303
|
-
});
|
|
304
|
-
test('error on duplicate suites', async () => {
|
|
305
|
-
const config = new ConfigManager({
|
|
306
|
-
suites: [
|
|
307
|
-
{ name: 'unit', files: 'tests/**/*.spec.ts' },
|
|
308
|
-
{ name: 'unit', files: 'tests/**/*.spec.ts' },
|
|
309
|
-
],
|
|
310
|
-
}, {}).hydrate();
|
|
311
|
-
await wrapAssertions(() => {
|
|
312
|
-
assert.throws(() => new Planner(config), 'Duplicate suite "unit"');
|
|
313
|
-
});
|
|
314
|
-
});
|
|
315
|
-
test('error when suite filter mentions non-existing suite', async () => {
|
|
316
|
-
const config = new ConfigManager({
|
|
317
|
-
suites: [{ name: 'unit', files: 'tests/**/*.spec.ts' }],
|
|
318
|
-
}, {
|
|
319
|
-
_: ['functional'],
|
|
320
|
-
}).hydrate();
|
|
321
|
-
await wrapAssertions(() => {
|
|
322
|
-
assert.throws(() => new Planner(config), 'Cannot apply suites filter. "functional" suite is not configured');
|
|
323
|
-
});
|
|
324
|
-
});
|
|
325
|
-
test('error when suite filter is applied without defining suites', async () => {
|
|
326
|
-
const config = new ConfigManager({
|
|
327
|
-
suites: [],
|
|
328
|
-
}, {
|
|
329
|
-
_: ['functional'],
|
|
330
|
-
}).hydrate();
|
|
331
|
-
await wrapAssertions(() => {
|
|
332
|
-
assert.throws(() => new Planner(config), 'Cannot apply suites filter. You have not configured any test suites');
|
|
333
|
-
});
|
|
334
|
-
});
|
|
335
|
-
test('apply suites filter', async () => {
|
|
336
|
-
const config = new ConfigManager({
|
|
337
|
-
suites: [
|
|
338
|
-
{ name: 'unit', files: 'tests/**/*.spec.ts' },
|
|
339
|
-
{ name: 'functional', files: 'tests/**/*.spec.ts' },
|
|
340
|
-
],
|
|
341
|
-
}, {
|
|
342
|
-
_: ['functional'],
|
|
343
|
-
}).hydrate();
|
|
344
|
-
const { suites } = await new Planner(config).plan();
|
|
345
|
-
await wrapAssertions(() => {
|
|
346
|
-
assert.deepEqual(suites, [
|
|
347
|
-
{
|
|
348
|
-
name: 'functional',
|
|
349
|
-
files: 'tests/**/*.spec.ts',
|
|
350
|
-
filesURLs: [
|
|
351
|
-
new URL('../tests/base_reporter.spec.ts', import.meta.url),
|
|
352
|
-
new URL('../tests/cli_parser.spec.ts', import.meta.url),
|
|
353
|
-
new URL('../tests/config_manager.spec.ts', import.meta.url),
|
|
354
|
-
new URL('../tests/core.spec.ts', import.meta.url),
|
|
355
|
-
new URL('../tests/files_manager.spec.ts', import.meta.url),
|
|
356
|
-
new URL('../tests/planner.spec.ts', import.meta.url),
|
|
357
|
-
new URL('../tests/runner.spec.ts', import.meta.url),
|
|
358
|
-
],
|
|
359
|
-
retries: 0,
|
|
360
|
-
timeout: 2000,
|
|
361
|
-
configure: NOOP,
|
|
362
|
-
},
|
|
363
|
-
]);
|
|
364
|
-
});
|
|
365
|
-
});
|
|
366
|
-
});
|
|
367
|
-
test.describe('Planner | reporters', () => {
|
|
368
|
-
test('get collection of activated reporters', async () => {
|
|
369
|
-
const config = new ConfigManager({ files: ['tests/**/*.spec.ts'] }, {}).hydrate();
|
|
370
|
-
const { reporters } = await new Planner(config).plan();
|
|
371
|
-
await wrapAssertions(() => {
|
|
372
|
-
assert.deepEqual(reporters, [
|
|
373
|
-
{
|
|
374
|
-
handler: reporters[0].handler,
|
|
375
|
-
name: 'spec',
|
|
376
|
-
},
|
|
377
|
-
]);
|
|
378
|
-
});
|
|
379
|
-
});
|
|
380
|
-
test('get collection of manually activated reporters', async () => {
|
|
381
|
-
const config = new ConfigManager({
|
|
382
|
-
files: ['tests/**/*.spec.ts'],
|
|
383
|
-
reporters: {
|
|
384
|
-
activated: ['dot'],
|
|
385
|
-
list: [
|
|
386
|
-
{
|
|
387
|
-
name: 'spec',
|
|
388
|
-
handler: {},
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
name: 'dot',
|
|
392
|
-
handler: {},
|
|
393
|
-
},
|
|
394
|
-
],
|
|
395
|
-
},
|
|
396
|
-
}, {}).hydrate();
|
|
397
|
-
const { reporters } = await new Planner(config).plan();
|
|
398
|
-
await wrapAssertions(() => {
|
|
399
|
-
assert.deepEqual(reporters, [
|
|
400
|
-
{
|
|
401
|
-
handler: {},
|
|
402
|
-
name: 'dot',
|
|
403
|
-
},
|
|
404
|
-
]);
|
|
405
|
-
});
|
|
406
|
-
});
|
|
407
|
-
test('get collection of reporters activated via CLI flag', async () => {
|
|
408
|
-
const config = new ConfigManager({
|
|
409
|
-
files: ['tests/**/*.spec.ts'],
|
|
410
|
-
reporters: {
|
|
411
|
-
activated: ['dot'],
|
|
412
|
-
list: [
|
|
413
|
-
{
|
|
414
|
-
name: 'spec',
|
|
415
|
-
handler: {},
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
name: 'dot',
|
|
419
|
-
handler: {},
|
|
420
|
-
},
|
|
421
|
-
],
|
|
422
|
-
},
|
|
423
|
-
}, {
|
|
424
|
-
reporter: 'spec',
|
|
425
|
-
}).hydrate();
|
|
426
|
-
const { reporters } = await new Planner(config).plan();
|
|
427
|
-
await wrapAssertions(() => {
|
|
428
|
-
assert.deepEqual(reporters, [
|
|
429
|
-
{
|
|
430
|
-
handler: {},
|
|
431
|
-
name: 'spec',
|
|
432
|
-
},
|
|
433
|
-
]);
|
|
434
|
-
});
|
|
435
|
-
});
|
|
436
|
-
test('report error when activated reporter is not in the list', async () => {
|
|
437
|
-
const config = new ConfigManager({
|
|
438
|
-
files: ['tests/**/*.spec.ts'],
|
|
439
|
-
reporters: {
|
|
440
|
-
activated: ['progress'],
|
|
441
|
-
list: [
|
|
442
|
-
{
|
|
443
|
-
name: 'spec',
|
|
444
|
-
handler: {},
|
|
445
|
-
},
|
|
446
|
-
{
|
|
447
|
-
name: 'dot',
|
|
448
|
-
handler: {},
|
|
449
|
-
},
|
|
450
|
-
],
|
|
451
|
-
},
|
|
452
|
-
}, {}).hydrate();
|
|
453
|
-
await wrapAssertions(() => {
|
|
454
|
-
assert.throws(() => new Planner(config), 'Invalid reporter "progress". Make sure to register it first inside the "reporters.list" array');
|
|
455
|
-
});
|
|
456
|
-
});
|
|
457
|
-
test('report error when CLI activated reporter is not in the list', async () => {
|
|
458
|
-
const config = new ConfigManager({
|
|
459
|
-
files: ['tests/**/*.spec.ts'],
|
|
460
|
-
reporters: {
|
|
461
|
-
activated: ['dot'],
|
|
462
|
-
list: [
|
|
463
|
-
{
|
|
464
|
-
name: 'spec',
|
|
465
|
-
handler: {},
|
|
466
|
-
},
|
|
467
|
-
{
|
|
468
|
-
name: 'dot',
|
|
469
|
-
handler: {},
|
|
470
|
-
},
|
|
471
|
-
],
|
|
472
|
-
},
|
|
473
|
-
}, {
|
|
474
|
-
reporter: 'progress',
|
|
475
|
-
}).hydrate();
|
|
476
|
-
await wrapAssertions(() => {
|
|
477
|
-
assert.throws(() => new Planner(config), 'Invalid reporter "progress". Make sure to register it first inside the "reporters.list" array');
|
|
478
|
-
});
|
|
479
|
-
});
|
|
480
|
-
});
|
|
481
|
-
test.describe('Planner | refinerFilters', () => {
|
|
482
|
-
test('get refinerFilters from the filters list', async () => {
|
|
483
|
-
const config = new ConfigManager({
|
|
484
|
-
files: ['tests/**/*.spec.ts'],
|
|
485
|
-
filters: {
|
|
486
|
-
tests: ['user'],
|
|
487
|
-
tags: ['@slow'],
|
|
488
|
-
files: ['manager'],
|
|
489
|
-
groups: ['customers'],
|
|
490
|
-
},
|
|
491
|
-
}, {}).hydrate();
|
|
492
|
-
const { refinerFilters } = await new Planner(config).plan();
|
|
493
|
-
await wrapAssertions(() => {
|
|
494
|
-
assert.deepEqual(refinerFilters, [
|
|
495
|
-
{
|
|
496
|
-
layer: 'tests',
|
|
497
|
-
filters: ['user'],
|
|
498
|
-
},
|
|
499
|
-
{
|
|
500
|
-
layer: 'tags',
|
|
501
|
-
filters: ['@slow'],
|
|
502
|
-
},
|
|
503
|
-
{
|
|
504
|
-
layer: 'groups',
|
|
505
|
-
filters: ['customers'],
|
|
506
|
-
},
|
|
507
|
-
]);
|
|
508
|
-
});
|
|
509
|
-
});
|
|
510
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|