Skip to content

Commit cf60990

Browse files
authored
refactor(config): show warning message for sourceMap: false (#2557)
1 parent e448638 commit cf60990

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/config/config-set.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ describe('parsedTsConfig', () => {
103103
allowSyntheticDefaultImports: true,
104104
esModuleInterop: false,
105105
})
106-
expect(target.lines.warn.join()).toMatchInlineSnapshot(`
106+
expect(target.lines.warn.last).toMatchInlineSnapshot(`
107107
"[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.
108108
"
109109
`)

src/config/config-set.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,13 @@ export class ConfigSet {
452452

453453
// parse json, merge config extending others, ...
454454
const result = ts.parseJsonConfigFileContent(config, ts.sys, basePath, undefined, configFileName)
455+
if (result.options.sourceMap === false) {
456+
this.logger.warn(
457+
interpolate(Deprecations.SourceMapFalseNote, {
458+
path: result.options.configFilePath,
459+
}),
460+
)
461+
}
455462
const { _overriddenCompilerOptions: forcedOptions } = this
456463
const finalOptions = result.options
457464
// Target ES5 output by default (instead of ES3).

src/utils/messages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export const enum Deprecations {
4242
TsConfig = 'The option `tsConfig` is deprecated and will be removed in ts-jest 27, use `tsconfig` instead',
4343
PackageJson = 'The option `packageJson` is deprecated and will be removed in ts-jest 27. This option is not used by internal `ts-jest`',
4444
PathRegex = 'The option `pathRegex` is deprecated and will be removed in ts-jest 27, use `exclude` instead',
45+
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',
4546
}
4647

4748
/**

0 commit comments

Comments
 (0)