I am unable to disable ts-jest diagnostics.
I鈥檓 using the following jest.config.js:
module.exports = {
preset: 'ts-jest',
globals: {
'ts-jest': {
diagnostics: false,
},
},
};
This outputs
ts-jest[config] (WARN) TypeScript diagnostics (customize using `[jest-config].globals.ts-jest.diagnostics` option):
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.
Diagnostics are disabled
{"context":{"allowJs":false,"logLevel":20,"namespace":"jest-preset","package":"ts-jest","version":"24.0.2"},"message":"creating jest presets not handling JavaScript files","sequence":1,"time":"2019-08-14T08:16:41.987Z"}
{"context":{"logLevel":20,"namespace":"Importer","package":"ts-jest","version":"24.0.2"},"message":"creating Importer singleton","sequence":2,"time":"2019-08-14T08:16:43.034Z"}
{"context":{"allowJs":false,"logLevel":20,"namespace":"jest-preset","package":"ts-jest","version":"24.0.2"},"message":"creating jest presets not handling JavaScript files","sequence":3,"time":"2019-08-14T08:16:43.037Z"}
{"context":{"actualVersion":"24.8.0","expectedVersion":">=24 <25","logLevel":20,"namespace":"versions","package":"ts-jest","version":"24.0.2"},"message":"checking version of jest: OK","sequence":4,"time":"2019-08-14T08:16:43.038Z"}
{"context":{"baseOptions":{},"logLevel":20,"namespace":"jest-transformer","package":"ts-jest","transformerId":1,"version":"24.0.2"},"message":"created new transformer","sequence":5,"time":"2019-08-14T08:16:43.038Z"}
{"context":{"fileName":"/home/remco/Projects/tiny-jsx/h.test.tsx","logLevel":20,"namespace":"jest-transformer","package":"ts-jest","transformOptions":{"config":{"automock":false,"browser":false,"cache":true,"cacheDirectory":"/tmp/jest_rs","clearMocks":false,"coveragePathIgnorePatterns":["/node_modules/"],"cwd":"/home/remco/Projects/tiny-jsx","dependencyExtractor":null,"detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"filter":null,"forceCoverageMatch":[],"globalSetup":null,"globalTeardown":null,"globals":{},"haste":{"computeSha1":false,"providesModuleNodeModules":[],"throwOnModuleCollision":false},"moduleDirectories":["node_modules"],"moduleFileExtensions":["js","json","jsx","ts","tsx","node"],"moduleNameMapper":{},"modulePathIgnorePatterns":[],"name":"888496d3960f5be6df23c5f8d712e230","prettierPath":"prettier","resetMocks":false,"resetModules":false,"resolver":null,"restoreMocks":false,"rootDir":"/home/remco/Projects/tiny-jsx","roots":["/home/remco/Projects/tiny-jsx"],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"snapshotSerializers":[],"testEnvironment":"/home/remco/Projects/tiny-jsx/node_modules/jest-environment-jsdom/build/index.js","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":["**/__tests__/**/*.[jt]s?(x)","**/?(*.)+(spec|test).[tj]s?(x)"],"testPathIgnorePatterns":["/node_modules/"],"testRegex":[],"testRunner":"/home/remco/Projects/tiny-jsx/node_modules/jest-jasmine2/build/index.js","testURL":"http://localhost","timers":"real","transform":[["^.+\\.tsx?$","/home/remco/Projects/tiny-jsx/node_modules/ts-jest/dist/index.js"]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"instrument":false,"rootDir":"/home/remco/Projects/tiny-jsx"},"transformerId":1,"version":"24.0.2"},"message":"computing cache key for /home/remco/Projects/tiny-jsx/h.test.tsx","sequence":6,"time":"2019-08-14T08:16:43.038Z"}
{"context":{"logLevel":30,"namespace":"jest-transformer","package":"ts-jest","transformerId":1,"version":"24.0.2"},"message":"no matching config-set found, creating a new one","sequence":7,"time":"2019-08-14T08:16:43.039Z"}
{"context":{"config":{"automock":false,"browser":false,"cache":true,"cacheDirectory":"/tmp/jest_rs","clearMocks":false,"coveragePathIgnorePatterns":["/node_modules/"],"cwd":"/home/remco/Projects/tiny-jsx","dependencyExtractor":null,"detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"filter":null,"forceCoverageMatch":[],"globalSetup":null,"globalTeardown":null,"globals":{},"haste":{"computeSha1":false,"providesModuleNodeModules":[],"throwOnModuleCollision":false},"moduleDirectories":["node_modules"],"moduleFileExtensions":["js","json","jsx","ts","tsx","node"],"moduleNameMapper":{},"modulePathIgnorePatterns":[],"name":"888496d3960f5be6df23c5f8d712e230","prettierPath":"prettier","resetMocks":false,"resetModules":false,"resolver":null,"restoreMocks":false,"rootDir":"/home/remco/Projects/tiny-jsx","roots":["/home/remco/Projects/tiny-jsx"],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"snapshotSerializers":[],"testEnvironment":"/home/remco/Projects/tiny-jsx/node_modules/jest-environment-jsdom/build/index.js","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":["**/__tests__/**/*.[jt]s?(x)","**/?(*.)+(spec|test).[tj]s?(x)"],"testPathIgnorePatterns":["/node_modules/"],"testRegex":[],"testRunner":"/home/remco/Projects/tiny-jsx/node_modules/jest-jasmine2/build/index.js","testURL":"http://localhost","timers":"real","transform":[["^.+\\.tsx?$","/home/remco/Projects/tiny-jsx/node_modules/ts-jest/dist/index.js"]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"logLevel":20,"namespace":"backports","package":"ts-jest","transformerId":1,"version":"24.0.2"},"message":"backporting config","sequence":8,"time":"2019-08-14T08:16:43.039Z"}
{"context":{"jestConfig":{"automock":false,"browser":false,"cache":true,"cacheDirectory":"/tmp/jest_rs","clearMocks":false,"coveragePathIgnorePatterns":["/node_modules/"],"cwd":"/home/remco/Projects/tiny-jsx","dependencyExtractor":null,"detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"filter":null,"forceCoverageMatch":[],"globalSetup":null,"globalTeardown":null,"globals":{"ts-jest":{}},"haste":{"computeSha1":false,"providesModuleNodeModules":[],"throwOnModuleCollision":false},"moduleDirectories":["node_modules"],"moduleFileExtensions":["js","json","jsx","ts","tsx","node"],"moduleNameMapper":{},"modulePathIgnorePatterns":[],"name":"888496d3960f5be6df23c5f8d712e230","prettierPath":"prettier","resetMocks":false,"resetModules":false,"resolver":null,"restoreMocks":false,"rootDir":"/home/remco/Projects/tiny-jsx","roots":["/home/remco/Projects/tiny-jsx"],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"snapshotSerializers":[],"testEnvironment":"/home/remco/Projects/tiny-jsx/node_modules/jest-environment-jsdom/build/index.js","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":["**/__tests__/**/*.[jt]s?(x)","**/?(*.)+(spec|test).[tj]s?(x)"],"testPathIgnorePatterns":["/node_modules/"],"testRegex":[],"testRunner":"/home/remco/Projects/tiny-jsx/node_modules/jest-jasmine2/build/index.js","testURL":"http://localhost","timers":"real","transform":[["^.+\\.tsx?$","/home/remco/Projects/tiny-jsx/node_modules/ts-jest/dist/index.js"]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"logLevel":20,"namespace":"config","package":"ts-jest","transformerId":1,"version":"24.0.2"},"message":"normalized jest config","sequence":9,"time":"2019-08-14T08:16:43.040Z"}
{"context":{"logLevel":20,"namespace":"config","package":"ts-jest","transformerId":1,"tsJestConfig":{"compiler":"typescript","diagnostics":{"ignoreCodes":[6059,18002,18003],"pretty":true,"throws":true},"isolatedModules":false,"packageJson":{"kind":"file"},"transformers":[],"tsConfig":{"kind":"file"}},"version":"24.0.2"},"message":"normalized ts-jest config","sequence":10,"time":"2019-08-14T08:16:43.040Z"}
{"context":{"logLevel":20,"namespace":"config","package":"ts-jest","transformerId":1,"version":"24.0.2"},"message":"babel is disabled","sequence":11,"time":"2019-08-14T08:16:43.042Z"}
{"context":{"logLevel":20,"namespace":"Importer","package":"ts-jest","requireResult":{"exists":true,"given":"typescript","path":"/home/remco/Projects/tiny-jsx/node_modules/typescript/lib/typescript.js"},"version":"24.0.2"},"message":"loaded module typescript","sequence":12,"time":"2019-08-14T08:16:43.240Z"}
{"context":{"logLevel":20,"namespace":"Importer","package":"ts-jest","version":"24.0.2"},"message":"patching typescript","sequence":13,"time":"2019-08-14T08:16:43.240Z"}
{"context":{"actualVersion":"3.5.3","expectedVersion":">=2.7 <4","logLevel":20,"namespace":"versions","package":"ts-jest","version":"24.0.2"},"message":"checking version of typescript: OK","sequence":14,"time":"2019-08-14T08:16:43.241Z"}
{"context":{"logLevel":20,"namespace":"config","package":"ts-jest","transformerId":1,"tsConfigFileName":"/home/remco/Projects/tiny-jsx/tsconfig.json","version":"24.0.2"},"message":"readTsConfig(): reading /home/remco/Projects/tiny-jsx/tsconfig.json","sequence":15,"time":"2019-08-14T08:16:43.241Z"}
{"context":{"diagnosticCodes":[151001],"diagnosticText":"\u001b[94mmessage\u001b[0m\u001b[90m TS151001: \u001b[0mIf 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.\n","logLevel":20,"namespace":"TSError","package":"ts-jest","version":"24.0.2"},"message":"created new TSError","sequence":16,"time":"2019-08-14T08:16:43.251Z"}
{"context":{"error":{"diagnosticCodes":[151001],"diagnosticText":"\u001b[94mmessage\u001b[0m\u001b[90m TS151001: \u001b[0mIf 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.\n"},"logLevel":40,"namespace":"config","package":"ts-jest","transformerId":1,"version":"24.0.2"},"message":"TypeScript diagnostics (customize using `[jest-config].globals.ts-jest.diagnostics` option):\n\u001b[94mmessage\u001b[0m\u001b[90m TS151001: \u001b[0mIf 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.","sequence":17,"time":"2019-08-14T08:16:43.252Z"}
{"context":{"logLevel":20,"namespace":"config","package":"ts-jest","transformerId":1,"tsconfig":{"input":{"compilerOptions":{"inlineSourceMap":true,"jsx":"react","jsxFactory":"h","lib":["dom","esnext"],"noEmit":true,"noUnusedLocals":true,"noUnusedParameters":true,"strict":true,"target":"esnext","types":["jest"]}},"resolved":{"compileOnSave":false,"configFileSpecs":{"includeSpecs":["**/*"],"validatedIncludeSpecs":["**/*"],"wildcardDirectories":{"/home/remco/Projects/tiny-jsx":1}},"errors":[{"category":3,"code":151001,"messageText":"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."}],"fileNames":["/home/remco/Projects/tiny-jsx/h.test.tsx","/home/remco/Projects/tiny-jsx/h.ts"],"options":{"allowSyntheticDefaultImports":true,"configFilePath":"/home/remco/Projects/tiny-jsx/tsconfig.json","declaration":false,"inlineSourceMap":false,"inlineSources":true,"jsx":2,"jsxFactory":"h","lib":["lib.dom.d.ts","lib.esnext.d.ts"],"module":1,"noEmit":false,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"$$ts-jest$$","removeComments":false,"sourceMap":true,"strict":true,"target":8,"types":["jest"]},"raw":{"compileOnSave":false,"compilerOptions":{"inlineSourceMap":true,"jsx":"react","jsxFactory":"h","lib":["dom","esnext"],"noEmit":true,"noUnusedLocals":true,"noUnusedParameters":true,"strict":true,"target":"esnext","types":["jest"]}},"typeAcquisition":{"enable":false,"exclude":[],"include":[]},"wildcardDirectories":{"/home/remco/Projects/tiny-jsx":1}}},"version":"24.0.2"},"message":"normalized typescript config","sequence":18,"time":"2019-08-14T08:16:43.252Z"}
{"context":{"fileName":"/home/remco/Projects/tiny-jsx/h.ts","logLevel":20,"namespace":"jest-transformer","package":"ts-jest","transformOptions":{"config":{"automock":false,"browser":false,"cache":true,"cacheDirectory":"/tmp/jest_rs","clearMocks":false,"coveragePathIgnorePatterns":["/node_modules/"],"cwd":"/home/remco/Projects/tiny-jsx","dependencyExtractor":null,"detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"filter":null,"forceCoverageMatch":[],"globalSetup":null,"globalTeardown":null,"globals":{},"haste":{"computeSha1":false,"providesModuleNodeModules":[],"throwOnModuleCollision":false},"moduleDirectories":["node_modules"],"moduleFileExtensions":["js","json","jsx","ts","tsx","node"],"moduleNameMapper":{},"modulePathIgnorePatterns":[],"name":"888496d3960f5be6df23c5f8d712e230","prettierPath":"prettier","resetMocks":false,"resetModules":false,"resolver":null,"restoreMocks":false,"rootDir":"/home/remco/Projects/tiny-jsx","roots":["/home/remco/Projects/tiny-jsx"],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"snapshotSerializers":[],"testEnvironment":"/home/remco/Projects/tiny-jsx/node_modules/jest-environment-jsdom/build/index.js","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":["**/__tests__/**/*.[jt]s?(x)","**/?(*.)+(spec|test).[tj]s?(x)"],"testPathIgnorePatterns":["/node_modules/"],"testRegex":[],"testRunner":"/home/remco/Projects/tiny-jsx/node_modules/jest-jasmine2/build/index.js","testURL":"http://localhost","timers":"real","transform":[["^.+\\.tsx?$","/home/remco/Projects/tiny-jsx/node_modules/ts-jest/dist/index.js"]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"instrument":false,"rootDir":"/home/remco/Projects/tiny-jsx"},"transformerId":1,"version":"24.0.2"},"message":"computing cache key for /home/remco/Projects/tiny-jsx/h.ts","sequence":19,"time":"2019-08-14T08:16:43.254Z"}
hi @remcohaszing , is this issue still occurred in ts-jest 24.1.0 ? If yes, would you please provide us a minimum reproduce repo ?
Same here. I can't disable the diagnostic messages. Not all or by message code.
jest.config.js:
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
globals: {
'ts-jest': {
diagnostics: false
}
}
};
package.json (Snippet)
{
"devDependencies": {
"@types/jest": "^24.0.23",
"jest": "^24.9.0",
"ts-jest": "^24.1.0",
"typescript": "^3.7.2",
}
}
Console
ts-jest[config] (WARN) TypeScript diagnostics (customize using `[jest-config].globals.ts-jest.diagnostics` option):
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.
hi, the log you saw actually came from this logger line. This logging is more like a warning, disabling diagnostics means if there is a compilation issue, ts-jest won't throw error.
Disabling diagnostics itself works, just the logging is misunderstood. I will close this issue as it's not broken functionality. ts-jest can adjust the documentation to make clear about this diagnostic logging or you can submit a PR to adjust the documentation.
Most helpful comment
Same here. I can't disable the diagnostic messages. Not all or by message code.
jest.config.js:
package.json (Snippet)
Console