Skip to content

Commit

Permalink
feat: link jest config types on npx ts-jest:init (#2742)
Browse files Browse the repository at this point in the history
  • Loading branch information
wtho committed Jul 11, 2021
1 parent 48d105f commit f51ba05
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cli/cli.spec.ts
Expand Up @@ -135,7 +135,8 @@ Jest configuration written to "${normalize('/foo/bar/jest.config.js')}".
expect(fs.writeFileSync.mock.calls).toEqual([
[
normalize('/foo/bar/jest.config.js'),
`module.exports = {
`/** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};`,
Expand All @@ -158,6 +159,7 @@ Jest configuration written to "${normalize('/foo/bar/jest.config.foo.js')}".
normalize('/foo/bar/jest.config.foo.js'),
`const { jsWithTs: tsjPreset } = require('ts-jest/presets');
/** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
...tsjPreset,
globals: {
Expand Down
1 change: 1 addition & 0 deletions src/cli/config/init.ts
Expand Up @@ -90,6 +90,7 @@ export const run: CliCommand = async (args: Arguments /* , logger: Logger */) =>
if (!jestPreset) {
content.push(`${preset.jsImport('tsjPreset')};`, '')
}
content.push(`/** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */`)
content.push('module.exports = {')
if (jestPreset) {
content.push(` preset: '${preset.name}',`)
Expand Down

0 comments on commit f51ba05

Please sign in to comment.