-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(helpers): deprecate import from ts-jest, now ts-jest/utils
Importing from `ts-jest` everything will possibly make collision with future jest API. Also any star export or import might not be compatible with the target project. Now all helpers to be used in tests or config files have been moved to `ts-jest/utils`. Original ones have been kept in `ts-jest` for now, with a deprecation warning when using them. Closes #782
- Loading branch information
Showing
17 changed files
with
133 additions
and
80 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { mocked } from 'ts-jest' | ||
import { foo } from './to-mock' | ||
jest.mock('./to-mock') | ||
|
||
test('foo', () => { | ||
foo() | ||
// it should log that the helper moved | ||
expect(mocked(foo).mock.calls.length).toBe(1) | ||
}) |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const { jestPreset } = require('ts-jest') | ||
const presets = require('ts-jest/presets') | ||
|
||
module.exports = Object.assign({}, jestPreset, { | ||
module.exports = Object.assign({}, presets.defaults, { | ||
testEnvironment: 'node', | ||
globals: { 'ts-jest': { tsConfig: {} } }, | ||
}) |
This file was deleted.
Oops, something went wrong.
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
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
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,17 @@ | ||
import { createJestPreset } from '../config/create-jest-preset' | ||
import { pathsToModuleNameMapper } from '../config/paths-to-module-name-mapper' | ||
|
||
import * as subject from './exported' | ||
import { mocked } from './testing' | ||
|
||
describe('exported helpers', () => { | ||
it('should have mocked', () => { | ||
expect(subject).toHaveProperty('mocked', mocked) | ||
}) | ||
it('should have createJestPreset', () => { | ||
expect(subject).toHaveProperty('createJestPreset', createJestPreset) | ||
}) | ||
it('should have pathsToModuleNameMapper', () => { | ||
expect(subject).toHaveProperty('pathsToModuleNameMapper', pathsToModuleNameMapper) | ||
}) | ||
}) |
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 @@ | ||
export { mocked } from './testing' | ||
export { createJestPreset } from '../config/create-jest-preset' | ||
export { pathsToModuleNameMapper } from '../config/paths-to-module-name-mapper' |
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 @@ | ||
export * from '../dist/util/exported' |
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 @@ | ||
module.exports = require('../dist/util/exported') |