Running my tests on version 23.10.1 outputs an error message. Version 23.10.0 works properly.
Tests should run without any issue. Even a project with a single dummy expect(1 + 1).toBe(2) doesn't work.
{"context":{"logLevel":20,"namespace":"Importer","package":"ts-jest","version":"23.10.1"},"message":"creating Importer singleton","sequence":1,"time":"2018-09-21T12:09:41.888Z"}
{"context":{"allowJs":false,"logLevel":20,"namespace":"jest-preset","package":"ts-jest","version":"23.10.1"},"message":"creating jest presets not handling JavaScript files","sequence":2,"time":"2018-09-21T12:09:41.892Z"}
{"context":{"actualVersion":"23.6.0","expectedVersion":">=22 <24","logLevel":20,"namespace":"versions","package":"ts-jest","version":"23.10.1"},"message":"checking version of jest: OK","sequence":3,"time":"2018-09-21T12:09:41.895Z"}
{"context":{"baseOptions":{},"logLevel":20,"namespace":"jest-transformer","package":"ts-jest","transformerId":1,"version":"23.10.1"},"message":"created new transformer","sequence":4,"time":"2018-09-21T12:09:41.895Z"}
{"context":{"fileName":"/projectURL/src/index.spec.ts","logLevel":20,"namespace":"jest-transformer","package":"ts-jest","transformOptions":{"instrument":false,"rootDir":"/projectURL"},"transformerId":1,"version":"23.10.1"},"message":"computing cache key for /projectURL/src/index.spec.ts","sequence":5,"time":"2018-09-21T12:09:41.896Z"}
{"context":{"logLevel":30,"namespace":"jest-transformer","package":"ts-jest","transformerId":1,"version":"23.10.1"},"message":"no matching config-set found, creating a new one","sequence":6,"time":"2018-09-21T12:09:41.896Z"}
{"context":{"config":{"automock":false,"browser":false,"cache":true,"cacheDirectory":"/var/folders/nb/m260xrh97r71ht8_41q1k5200000gn/T/jest_dx","clearMocks":false,"coveragePathIgnorePatterns":["/node_modules/"],"cwd":"/projectURL","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"filter":null,"forceCoverageMatch":[],"globals":{},"haste":{"providesModuleNodeModules":[]},"moduleDirectories":["node_modules"],"moduleFileExtensions":["ts","tsx","js","jsx","json","node"],"moduleNameMapper":{},"modulePathIgnorePatterns":[],"name":"36cf4cff8a211a5cfdd96a9117207b64","prettierPath":"/projectURL/node_modules/prettier/index.js","resetMocks":false,"resetModules":false,"resolver":null,"restoreMocks":false,"rootDir":"/projectURL","roots":["/projectURL"],"runner":"jest-runner","setupFiles":[],"setupTestFrameworkScriptFile":null,"skipFilter":false,"snapshotSerializers":[],"testEnvironment":"jest-environment-jsdom","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":["/node_modules/"],"testRegex":"(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$","testRunner":"/projectURL/node_modules/jest-jasmine2/build/index.js","testURL":"http://localhost","timers":"real","transform":[["^.+\\.tsx?$","/projectURL/node_modules/ts-jest/dist/index.js"]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"logLevel":20,"namespace":"backports","package":"ts-jest","transformerId":1,"version":"23.10.1"},"message":"backporting config","sequence":7,"time":"2018-09-21T12:09:41.897Z"}
{"context":{"jestConfig":{"automock":false,"browser":false,"cache":true,"cacheDirectory":"/var/folders/nb/m260xrh97r71ht8_41q1k5200000gn/T/jest_dx","clearMocks":false,"coveragePathIgnorePatterns":["/node_modules/"],"cwd":"/projectURL","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"filter":null,"forceCoverageMatch":[],"globals":{"ts-jest":{}},"haste":{"providesModuleNodeModules":[]},"moduleDirectories":["node_modules"],"moduleFileExtensions":["ts","tsx","js","jsx","json","node"],"moduleNameMapper":{},"modulePathIgnorePatterns":[],"name":"36cf4cff8a211a5cfdd96a9117207b64","prettierPath":"/projectURL/node_modules/prettier/index.js","resetMocks":false,"resetModules":false,"resolver":null,"restoreMocks":false,"rootDir":"/projectURL","roots":["/projectURL"],"runner":"jest-runner","setupFiles":[],"setupTestFrameworkScriptFile":null,"skipFilter":false,"snapshotSerializers":[],"testEnvironment":"jest-environment-jsdom","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":["/node_modules/"],"testRegex":"(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$","testRunner":"/projectURL/node_modules/jest-jasmine2/build/index.js","testURL":"http://localhost","timers":"real","transform":[["^.+\\.tsx?$","/projectURL/node_modules/ts-jest/dist/index.js"]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"logLevel":20,"namespace":"config","package":"ts-jest","transformerId":1,"version":"23.10.1"},"message":"normalized jest config","sequence":8,"time":"2018-09-21T12:09:41.897Z"}
{"context":{"logLevel":20,"namespace":"config","package":"ts-jest","transformerId":1,"tsJestConfig":{"compiler":"typescript","diagnostics":{"ignoreCodes":[6059,18002,18003],"pretty":true,"throws":true},"isolatedModules":false,"transformers":[],"tsConfig":{"kind":"file"}},"version":"23.10.1"},"message":"normalized ts-jest config","sequence":9,"time":"2018-09-21T12:09:41.898Z"}
{"context":{"logLevel":20,"namespace":"config","package":"ts-jest","transformerId":1,"version":"23.10.1"},"message":"babel is disabled","sequence":10,"time":"2018-09-21T12:09:41.899Z"}
{"context":{"logLevel":20,"namespace":"Importer","package":"ts-jest","version":"23.10.1"},"message":"loaded module typescript","sequence":11,"time":"2018-09-21T12:09:42.097Z"}
{"context":{"logLevel":20,"namespace":"Importer","package":"ts-jest","version":"23.10.1"},"message":"patching typescript","sequence":12,"time":"2018-09-21T12:09:42.097Z"}
{"context":{"actualVersion":"3.0.3","expectedVersion":">=2.7 <4","logLevel":20,"namespace":"versions","package":"ts-jest","version":"23.10.1"},"message":"checking version of typescript: OK","sequence":13,"time":"2018-09-21T12:09:42.098Z"}
{"context":{"logLevel":20,"namespace":"config","package":"ts-jest","transformerId":1,"tsConfigFileName":"/projectURL/tsconfig.json","version":"23.10.1"},"message":"readTsConfig(): reading /projectURL/tsconfig.json","sequence":14,"time":"2018-09-21T12:09:42.098Z"}
{"context":{"diagnosticCodes":[151001],"diagnosticText":"\u001b[93mwarning\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":"23.10.1"},"message":"created new TSError","sequence":15,"time":"2018-09-21T12:09:42.131Z"}

Clone repo bellow and try running npm test.
https://github.com/mllustosa/ts-jest-issue
thanks @mllustosa, this is due to the use of esnext value for module in tsconfig. But yeah, it's a bug and should not trigger the diagnostic.
You can put this in your jest config to silent the issue while the fix get ready (this is explained in the documentation):
// jest.config.js
{
// ...
globals: {
'ts-jest': {
// ...
diagnostics: {
ignoreCodes: [151001]
}
}
}
}
You are great, man! thanks for the extremely fast reaction and for linking to the documentation. I've set warnOnly for now.
This is happening for me since going through an upgrade. The tests run fine, tsc runs fine, but I get this warning for all of my tests.
Disabling the diagnostic as demonstrated in this thread works, but I'm hesitant to disable a warning if there is a reason that warning is happening. Is this something that should still be fixed by ts-jest, or is there something else to do in our code? The warning isn't very clear on what the problem is.
To save any Angular developers stuck with this issue, if you are using jest-preset-angular, remember to read this section in the readme about having a custom ts-config globals setup. I hope this can save you some time debugging failing tests 馃
I believe this will become more of a problem now that the recently released Angular 8 defaults to esnext.
Is this going to become a problem? @huafu mentions on #753 that:
FYI we must enforce
commonjsmodule as Jest relies on it.
Most helpful comment
This is happening for me since going through an upgrade. The tests run fine, tsc runs fine, but I get this warning for all of my tests.
Disabling the diagnostic as demonstrated in this thread works, but I'm hesitant to disable a warning if there is a reason that warning is happening. Is this something that should still be fixed by
ts-jest, or is there something else to do in our code? The warning isn't very clear on what the problem is.