/
allow-js.test.ts
31 lines (27 loc) · 917 Bytes
/
allow-js.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
import { allPackageSetsWithPreset, allValidPackageSets } from '../__helpers__/templates'
import { configureTestCase } from '../__helpers__/test-case'
describe('using babel-jest for js files', () => {
const testCase = configureTestCase('allow-js', {
jestConfig: { testRegex: '(foo|bar)\\.spec\\.[jt]s$' },
})
testCase.runWithTemplates(allValidPackageSets, 0, (runTest, { testLabel }) => {
it(testLabel, () => {
const result = runTest()
expect(result.status).toBe(0)
})
})
})
describe('using ts-jest for js files', () => {
const testCase = configureTestCase('allow-js', {
jestConfig: {
preset: 'ts-jest/presets/js-with-ts',
testRegex: 'esm\\.spec\\.[jt]s$',
},
})
testCase.runWithTemplates(allPackageSetsWithPreset, 0, (runTest, { testLabel }) => {
it(testLabel, () => {
const result = runTest()
expect(result.status).toBe(0)
})
})
})