Skip to content

Commit 424fc25

Browse files
authored
(feat): support JS & JSX files in tsdx test (#486)
- JS & JSX are already supported in tsdx build, so this is just adding some better parity in tsdx test - more JS & JSX support also means better support for gradual TS migrations - JS + JSX spec files should also be ran, not just TS + TSX - run them with babel-jest, which is jest's default - changing transform meant babel-jest wasn't run on them anymore - notably, TSDX itself has tests written in JS, so TSDX would need this to dogfood itself - also get coverage from JS + JSX files too
1 parent 655bb53 commit 424fc25

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/createJestConfig.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ export function createJestConfig(
55
const config = {
66
transform: {
77
'.(ts|tsx)': require.resolve('ts-jest/dist'),
8+
'.(js|jsx)': require.resolve('babel-jest'), // jest's default
89
},
910
transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$'],
1011
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
11-
collectCoverageFrom: ['src/**/*.{ts,tsx}'],
12-
testMatch: ['<rootDir>/**/*.(spec|test).{ts,tsx}'],
12+
collectCoverageFrom: ['src/**/*.{ts,tsx,js,jsx}'],
13+
testMatch: ['<rootDir>/**/*.(spec|test).{ts,tsx,js,jsx}'],
1314
testURL: 'http://localhost',
1415
rootDir,
1516
watchPlugins: [

0 commit comments

Comments
 (0)