Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(config): set default outDir to $$ts-jest when allowJs is enabled without outDir #1472

Merged
merged 1 commit into from Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/config/config-set.spec.ts
Expand Up @@ -495,6 +495,10 @@ describe('typescript', () => {
})
})

it('should include default outDir $$ts-jest$$ when allowJs is enabled and no outDir from config', () => {
expect(get(void 0, { tsConfig: { allowJs: true } }).options.outDir).toBe('$$ts-jest$$')
})

it('should be able to read extends', () => {
const cs = createConfigSet({
tsJestConfig: { tsConfig: 'tsconfig.build.json' },
Expand Down
4 changes: 4 additions & 0 deletions src/config/config-set.ts
Expand Up @@ -714,6 +714,10 @@ export class ConfigSet {
finalOptions.allowSyntheticDefaultImports = true
}
}
// Make sure when allowJs is enabled, outDir is set otherwise we run into error: Cannot write file ... because it would overwrite input
if (finalOptions.allowJs && !finalOptions.outDir) {
finalOptions.outDir = '$$ts-jest$$'
}

// ensure undefined are removed and other values are overridden
for (const key of Object.keys(forcedOptions)) {
Expand Down