Skip to content

Commit

Permalink
refactor(config): show warning message for sourceMap: false (#2557)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl committed May 5, 2021
1 parent e448638 commit cf60990
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/config/config-set.spec.ts
Expand Up @@ -103,7 +103,7 @@ describe('parsedTsConfig', () => {
allowSyntheticDefaultImports: true,
esModuleInterop: false,
})
expect(target.lines.warn.join()).toMatchInlineSnapshot(`
expect(target.lines.warn.last).toMatchInlineSnapshot(`
"[level:40] message TS151001: If you have issues related to imports, you should consider setting \`esModuleInterop\` to \`true\` in your TypeScript configuration file (usually \`tsconfig.json\`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.
"
`)
Expand Down
7 changes: 7 additions & 0 deletions src/config/config-set.ts
Expand Up @@ -452,6 +452,13 @@ export class ConfigSet {

// parse json, merge config extending others, ...
const result = ts.parseJsonConfigFileContent(config, ts.sys, basePath, undefined, configFileName)
if (result.options.sourceMap === false) {
this.logger.warn(
interpolate(Deprecations.SourceMapFalseNote, {
path: result.options.configFilePath,
}),
)
}
const { _overriddenCompilerOptions: forcedOptions } = this
const finalOptions = result.options
// Target ES5 output by default (instead of ES3).
Expand Down
1 change: 1 addition & 0 deletions src/utils/messages.ts
Expand Up @@ -42,6 +42,7 @@ export const enum Deprecations {
TsConfig = 'The option `tsConfig` is deprecated and will be removed in ts-jest 27, use `tsconfig` instead',
PackageJson = 'The option `packageJson` is deprecated and will be removed in ts-jest 27. This option is not used by internal `ts-jest`',
PathRegex = 'The option `pathRegex` is deprecated and will be removed in ts-jest 27, use `exclude` instead',
SourceMapFalseNote = 'Got `sourceMap: false` from tsconfig file "{{path}}". This will disable source map support in ts-jest 27. Please set `sourceMap: true` in your tsconfig file "{{path}}" if you want to keep source map support on',
}

/**
Expand Down

0 comments on commit cf60990

Please sign in to comment.