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

refactor(config): show warning message for sourceMap: false #2557

Merged
merged 1 commit into from May 5, 2021
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
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