diff --git a/src/compiler/language-service.ts b/src/compiler/language-service.ts index 23411a4b7b..bbcadfc2fd 100644 --- a/src/compiler/language-service.ts +++ b/src/compiler/language-service.ts @@ -260,11 +260,10 @@ export const initializeLanguageServiceInstance = (configs: ConfigSet, logger: Lo } /* istanbul ignore next (this should never happen but is kept for security) */ if (output.emitSkipped) { - const message = interpolate(Errors.CannotProcessFile, { file: fileName }) if (TS_TSX_REGEX.test(fileName)) { - throw new Error(message) + throw new Error(interpolate(Errors.CannotProcessFile, { file: fileName })) } else { - logger.warn(message) + logger.warn(interpolate(Errors.CannotProcessFileReturnOriginal, { file: fileName })) return [code, '{}'] } diff --git a/src/utils/messages.ts b/src/utils/messages.ts index fbde27f389..935aa13de7 100644 --- a/src/utils/messages.ts +++ b/src/utils/messages.ts @@ -17,7 +17,8 @@ export const enum Errors { GotUnknownFileTypeWithBabel = 'Got a unknown file type to compile (file: {{path}}). To fix this, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match this kind of files anymore. If you still want Babel to process it, add another entry to the `transform` option with value `babel-jest` which key matches this type of files.', ConfigNoModuleInterop = '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.', MismatchNodeTargetMapping = 'There is a mismatch between your NodeJs version {{nodeJsVer}} and your TypeScript target {{compilationTarget}}. This might lead to some unexpected errors when running tests with `ts-jest`. To fix this, you can check https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping', - CannotProcessFile = "Unable to process '{{file}}', falling back to original file content. Please make sure that `outDir` in your tsconfig is neither `''` or `'.'`. You can also configure Jest config option `transformIgnorePatterns` to ignore {{file}} from transformation", + CannotProcessFileReturnOriginal = "Unable to process '{{file}}', falling back to original file content. You can also configure Jest config option `transformIgnorePatterns` to ignore {{file}} from transformation or make sure that `outDir` in your tsconfig is neither `''` or `'.'`", + CannotProcessFile = "Unable to process '{{file}}', please make sure that `outDir` in your tsconfig is neither `''` or `'.'`. You can also configure Jest config option `transformIgnorePatterns` to inform `ts-jest` to transform {{file}}", } /**