Skip to content

Commit f51ba05

Browse files
authoredJul 11, 2021
feat: link jest config types on npx ts-jest:init (#2742)
1 parent 48d105f commit f51ba05

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
 

‎src/cli/cli.spec.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ Jest configuration written to "${normalize('/foo/bar/jest.config.js')}".
135135
expect(fs.writeFileSync.mock.calls).toEqual([
136136
[
137137
normalize('/foo/bar/jest.config.js'),
138-
`module.exports = {
138+
`/** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */
139+
module.exports = {
139140
preset: 'ts-jest',
140141
testEnvironment: 'node',
141142
};`,
@@ -158,6 +159,7 @@ Jest configuration written to "${normalize('/foo/bar/jest.config.foo.js')}".
158159
normalize('/foo/bar/jest.config.foo.js'),
159160
`const { jsWithTs: tsjPreset } = require('ts-jest/presets');
160161
162+
/** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */
161163
module.exports = {
162164
...tsjPreset,
163165
globals: {

‎src/cli/config/init.ts

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export const run: CliCommand = async (args: Arguments /* , logger: Logger */) =>
9090
if (!jestPreset) {
9191
content.push(`${preset.jsImport('tsjPreset')};`, '')
9292
}
93+
content.push(`/** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */`)
9394
content.push('module.exports = {')
9495
if (jestPreset) {
9596
content.push(` preset: '${preset.name}',`)

0 commit comments

Comments
 (0)
Please sign in to comment.