-
Notifications
You must be signed in to change notification settings - Fork 110
/
Copy pathcombine-spec.js
66 lines (64 loc) · 1.66 KB
/
combine-spec.js
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
const { combineNycOptions, defaultNycOptions } = require('../../common-utils')
describe('Combine NYC options', () => {
it('overrides defaults', () => {
const pkgNycOptions = {
extends: '@istanbuljs/nyc-config-typescript',
all: true
}
const combined = combineNycOptions({
pkgNycOptions,
defaultNycOptions
})
cy.wrap(combined).should('deep.equal', {
extends: '@istanbuljs/nyc-config-typescript',
all: true,
'report-dir': './coverage',
reporter: ['lcov', 'clover', 'json'],
extension: ['.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx'],
excludeAfterRemap: true
})
})
it('allows to specify reporter, but changes to array', () => {
const pkgNycOptions = {
reporter: 'text'
}
const combined = combineNycOptions({
pkgNycOptions,
defaultNycOptions
})
cy.wrap(combined).should('deep.equal', {
'report-dir': './coverage',
reporter: ['text'],
extension: ['.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx'],
excludeAfterRemap: true
})
})
it('combines multiple options', () => {
const pkgNycOptions = {
all: true,
extension: '.js'
}
const nycrc = {
include: ['foo.js']
}
const nycrcJson = {
exclude: ['bar.js'],
reporter: ['json']
}
const combined = combineNycOptions({
pkgNycOptions,
nycrc,
nycrcJson,
defaultNycOptions
})
cy.wrap(combined).should('deep.equal', {
all: true,
'report-dir': './coverage',
reporter: ['json'],
extension: ['.js'],
excludeAfterRemap: true,
include: ['foo.js'],
exclude: ['bar.js']
})
})
})