question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disabling diagnostics doesn’t work

See original GitHub issue

Issue

I am unable to disable ts-jest diagnostics.

I’m 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.

Expected behavior

Diagnostics are disabled

Debug log:

log file content
{"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"}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:27
  • Comments:10

github_iconTop GitHub Comments

24reactions
alexkunincommented, Jun 28, 2021

It seems this warning can be turned off in jest.config.js:

module.exports = {
  // ...
  globals: {
    'ts-jest': {
      diagnostics: {
        ignoreCodes: [ 'TS151001' ],
      },
    },
  },
  // ...
};
2reactions
ahnpnlcommented, Dec 30, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Enable or Disable Diagnostic Policy Service in ...
1. Open Run dialog box by making a joint press of Windows key and R. 2. Type in the command “services.msc” in the...
Read more >
How to disable the Diagnostics Tracking Service in Windows
How to disable the Diagnostics Tracking Service · Tap on the Windows-key, type services and hit enter. · Locate the service Diagnostics Tracking ......
Read more >
Diagnostic Mode "Something happened and your PIN isn't
Get into Recovery Mode (blue screen): At the login screen, click the bottom-right corner Power Button. Then, before doing anything, hold down ...
Read more >
How to Disable Telemetry on Windows 10 and 11 - MakeUseOf
Start by pressing Win + I and navigate to Privacy & security > Diagnostics & feedback. Toggle the button beside Send optional diagnostic...
Read more >
How to disable Diagnostic Tools? - Stack Overflow
I unchecked both checkboxes in Select Tools, but it doesn't seem to completely disable it. How do I turn it off (and on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found