-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
54 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
module.exports = { | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest', | ||
}, | ||
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$', | ||
moduleFileExtensions: ['ts', 'js'], | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
globals: { 'ts-jest': { tsConfig: {} } }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
module.exports = { | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest', | ||
}, | ||
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$', | ||
moduleFileExtensions: ['ts', 'js'], | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
globals: { 'ts-jest': { tsConfig: {}, babelJest: true } }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
module.exports = { | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest', | ||
}, | ||
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$', | ||
moduleFileExtensions: ['ts', 'js'], | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
globals: { 'ts-jest': { tsConfig: {}, babelJest: true } }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
module.exports = { | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest', | ||
}, | ||
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$', | ||
moduleFileExtensions: ['ts', 'js'], | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
globals: { 'ts-jest': { tsConfig: {} } }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const createJestPreset = require('./dist/utils/create-jest-preset').default; | ||
|
||
module.exports = createJestPreset(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as tsJest from './index'; | ||
|
||
describe('ts-jest', () => { | ||
it('should export a `createTransformer` function', () => { | ||
expect(typeof tsJest.createTransformer).toBe('function'); | ||
}); | ||
it('should export a `process` function', () => { | ||
expect(typeof tsJest.process).toBe('function'); | ||
}); | ||
it('should export a `getCacheKey` function', () => { | ||
expect(typeof tsJest.getCacheKey).toBe('function'); | ||
}); | ||
it('should export a `jestPreset` object', () => { | ||
expect(typeof tsJest.jestPreset).toBe('object'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { defaults } from 'jest-config'; | ||
import { CreateJestPresetOptions } from '../types'; | ||
|
||
// TODO: find out if tsconfig that we'll use contains `allowJs` | ||
// and change the transform so that it also uses ts-jest for js files | ||
|
||
export default function createJestPreset({ | ||
allowJs = false, | ||
}: CreateJestPresetOptions = {}) { | ||
return { | ||
transform: { | ||
...defaults.transform, | ||
[allowJs ? '^.+\\.[tj]sx?$' : '^.+\\.tsx?$']: 'ts-jest', | ||
}, | ||
testMatch: [ | ||
...defaults.testMatch, | ||
'**/__tests__/**/*.ts?(x)', | ||
'**/?(*.)+(spec|test).ts?(x)', | ||
], | ||
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'], | ||
}; | ||
} |