Skip to content

Commit 53175dd

Browse files
authored
feat: export ts-jest public apis from index.js (#3080)
Closes #3045 DEPRECATION * Import internal `ts-jest` stuffs from `ts-jest/<sub_path>` is discouraged. Users should switch to `import <name> from 'ts-jest'` instead. * Deprecation import path `import <name> from 'ts-jest/utils'`. Users should switch to `import <name> from 'ts-jest'` instead.
1 parent 6575fe2 commit 53175dd

File tree

70 files changed

+497
-133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+497
-133
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
- name: Install and build
7676
run: npm ci
7777
- name: Run tests with coverage
78-
run: npm run test-ci -- --coverage && cat ./coverage/lcov.info
78+
run: npm run test -- --coverage && cat ./coverage/lcov.info
7979
env:
8080
CI: true
8181
- name: Coveralls parallel

.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,8 @@ jspm_packages
4545
.idea
4646
.cache
4747

48-
# tests specific
49-
tests/simple-long-path/long-src-path
5048
# is linked to the temp dir of the os
51-
e2e/__workdir_synlink__
52-
**/.ts-jest-e2e.json
5349
.ts-jest-digest
54-
# while refactoring...
55-
old/
5650

5751
# binaries
5852
*.tgz

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jest-base.js
2626

2727
# Tsconfig
2828
tsconfig.build.json
29+
tsconfig.eslint.json
2930
tsconfig.json
3031
tsconfig.spec.json
3132

e2e/__tests__/ast-transformers.test.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import path from 'path'
33
import execa from 'execa'
44

55
import { json as runWithJson } from '../run-jest'
6-
import { runNpmInstall } from '../utils'
7-
8-
const { createBundle } = require('../../scripts/lib/bundle')
6+
import { runNpmInstall, tsJestBundle } from '../utils'
97

108
const AST_TRANSFORMERS_DIR_NAME = 'ast-transformers'
119

@@ -35,8 +33,7 @@ describe('path-mapping', () => {
3533

3634
beforeAll(() => {
3735
runNpmInstall(DIR)
38-
const bundle = createBundle()
39-
execa.sync('npm', ['install', '--no-package-lock', '--no-shrinkwrap', '--no-save', bundle], {
36+
execa.sync('npm', ['install', '--no-package-lock', '--no-shrinkwrap', '--no-save', tsJestBundle], {
4037
cwd: DIR,
4138
})
4239
})
@@ -69,8 +66,7 @@ describe('hoist-jest', () => {
6966

7067
beforeAll(() => {
7168
runNpmInstall(DIR)
72-
const bundle = createBundle()
73-
execa.sync('npm', ['install', '--no-package-lock', '--no-shrinkwrap', '--no-save', bundle], {
69+
execa.sync('npm', ['install', '--no-package-lock', '--no-shrinkwrap', '--no-save', tsJestBundle], {
7470
cwd: DIR,
7571
})
7672
})

e2e/__tests__/config-typing.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1+
import path from 'path'
2+
3+
import execa from 'execa'
4+
15
import { json as runWithJson } from '../run-jest'
6+
import { tsJestBundle } from '../utils'
27

38
const DIR_NAME = 'config-typing'
49

10+
beforeAll(() => {
11+
execa.sync('npm', ['install', '--no-package-lock', '--no-shrinkwrap', '--no-save', tsJestBundle], {
12+
cwd: path.join(__dirname, '..', DIR_NAME),
13+
})
14+
})
15+
516
test(`successfully runs the tests inside ${DIR_NAME}`, () => {
617
const { json } = runWithJson(DIR_NAME)
718

e2e/__tests__/test-utils.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1+
import path from 'path'
2+
3+
import execa from 'execa'
4+
15
import { json as runWithJson } from '../run-jest'
6+
import { tsJestBundle } from '../utils'
27

38
const DIR_NAME = 'test-utils'
49

10+
beforeAll(() => {
11+
execa.sync('npm', ['install', '--no-package-lock', '--no-shrinkwrap', '--no-save', tsJestBundle], {
12+
cwd: path.join(__dirname, '..', DIR_NAME),
13+
})
14+
})
15+
516
test(`successfully runs the tests inside ${DIR_NAME}`, () => {
617
const { json } = runWithJson(DIR_NAME, undefined, {
718
stripAnsi: true,

e2e/ast-transformers/hoist-jest/non-ts-factory/jest-isolated.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @type {import('../../../dist/types').InitialOptionsTsJest} */
1+
/** @type {import('../../../../dist').InitialOptionsTsJest} */
22
module.exports = {
33
automock: true,
44
globals: {

e2e/ast-transformers/hoist-jest/ts-factory/jest-isolated.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @type {import('../../../dist/types').InitialOptionsTsJest} */
1+
/** @type {import('../../../../dist').InitialOptionsTsJest} */
22
module.exports = {
33
automock: true,
44
globals: {

e2e/ast-transformers/path-mapping/ts-4.5+/jest-isolated.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @type {import('../../../../dist/types').InitialOptionsTsJest} */
1+
/** @type {import('../../../../dist').InitialOptionsTsJest} */
22
module.exports = {
33
globals: {
44
'ts-jest': {

e2e/ast-transformers/path-mapping/ts-4.5-/jest-isolated.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @type {import('../../../../dist/types').InitialOptionsTsJest} */
1+
/** @type {import('../../../../dist').InitialOptionsTsJest} */
22
module.exports = {
33
globals: {
44
'ts-jest': {

e2e/ast-transformers/transformer-in-ts/package-lock.json

Lines changed: 0 additions & 43 deletions
This file was deleted.

e2e/ast-transformers/transformer-options/jest-isolated.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @type {import('../../../dist/types').InitialOptionsTsJest} */
1+
/** @type {import('../../../dist').InitialOptionsTsJest} */
22
module.exports = {
33
globals: {
44
'ts-jest': {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test('should expose TypeScript types for Jest config', () => {
2+
expect(true).toBe(true)
3+
})

e2e/config-typing/__tests__/jest-config-typing.spec.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

e2e/config-typing/jest.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import type { InitialOptionsTsJest } from 'ts-jest'
2+
3+
const jestCfg: InitialOptionsTsJest = {
4+
globals: {
5+
'ts-jest': {
6+
isolatedModules: true,
7+
},
8+
},
9+
transform: {
10+
'^.+.tsx?$': 'ts-jest',
11+
},
12+
}
13+
14+
export default jestCfg

0 commit comments

Comments
 (0)