Skip to content

Commit

Permalink
(feat): support JS & JSX files in tsdx test (#486)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
agilgur5 authored Feb 4, 2020
1 parent 655bb53 commit 424fc25
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/createJestConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ export function createJestConfig(
const config = {
transform: {
'.(ts|tsx)': require.resolve('ts-jest/dist'),
'.(js|jsx)': require.resolve('babel-jest'), // jest's default
},
transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
collectCoverageFrom: ['src/**/*.{ts,tsx}'],
testMatch: ['<rootDir>/**/*.(spec|test).{ts,tsx}'],
collectCoverageFrom: ['src/**/*.{ts,tsx,js,jsx}'],
testMatch: ['<rootDir>/**/*.(spec|test).{ts,tsx,js,jsx}'],
testURL: 'http://localhost',
rootDir,
watchPlugins: [
Expand Down

0 comments on commit 424fc25

Please sign in to comment.