Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(config): set default outDir for enabled allowJs without outDir (#…
  • Loading branch information
ahnpnl committed Mar 30, 2020
1 parent ad58c9b commit 57c7af0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
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

0 comments on commit 57c7af0

Please sign in to comment.