-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
convert_configuration_spec.ts
90 lines (84 loc) · 2.01 KB
/
convert_configuration_spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import { describe, it } from 'mocha'
import { expect } from 'chai'
import { convertConfiguration } from './convert_configuration'
import { DEFAULT_CONFIGURATION } from '../configuration'
describe('convertConfiguration', () => {
it('should convert defaults correctly', async () => {
const result = await convertConfiguration(DEFAULT_CONFIGURATION, {})
expect(result).to.eql({
formats: {
files: {},
options: {},
publish: false,
stdout: 'progress',
},
runtime: {
dryRun: false,
failFast: false,
filterStacktraces: true,
parallel: 0,
retry: 0,
retryTagFilter: '',
strict: true,
worldParameters: {},
},
sources: {
defaultDialect: 'en',
names: [],
order: 'defined',
paths: [],
tagExpression: '',
},
support: {
requireModules: [],
requirePaths: [],
importPaths: [],
},
})
})
it('should map multiple formatters', async () => {
const result = await convertConfiguration(
{
...DEFAULT_CONFIGURATION,
format: [
'summary',
'message',
'json:./report.json',
'html:./report.html',
],
},
{}
)
expect(result.formats).to.eql({
stdout: 'message',
files: {
'./report.html': 'html',
'./report.json': 'json',
},
publish: false,
options: {},
})
})
it('should map formatters correctly when file:// urls are involved', async () => {
const result = await convertConfiguration(
{
...DEFAULT_CONFIGURATION,
format: [
'file:///my/fancy/formatter',
'json:./report.json',
'html:./report.html',
],
},
{}
)
expect(result.formats).to.eql({
stdout: 'file:///my/fancy/formatter',
files: {
'./report.html': 'html',
'./report.json': 'json',
},
publish: false,
options: {},
})
})
})