/
diagnostics.test.ts
33 lines (29 loc) · 986 Bytes
/
diagnostics.test.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
import { allValidPackageSets } from '../__helpers__/templates'
import { configureTestCase } from '../__helpers__/test-case'
describe('With diagnostics throw', () => {
const testCase = configureTestCase('diagnostics', {
noCache: true, // warnings shown only on first compilation
})
testCase.runWithTemplates(allValidPackageSets, 1, (runTest, { testLabel }) => {
it(testLabel, () => {
const result = runTest()
expect(result.status).toBe(1)
expect(result).toMatchSnapshot()
})
})
})
describe('With diagnostics warn only', () => {
const testCase = configureTestCase('diagnostics', {
tsJestConfig: {
diagnostics: { warnOnly: true },
},
noCache: true, // warnings shown only on first compilation
})
testCase.runWithTemplates(allValidPackageSets, 0, (runTest, { testLabel }) => {
it(testLabel, () => {
const result = runTest()
expect(result.status).toBe(0)
expect(result).toMatchSnapshot()
})
})
})