# content of ts-jest.log :
{"context":{"logLevel":20,"namespace":"config","package":"ts-jest","transformerId":1,"tsconfig":{"input":{"compilerOptions":{"types":["node","facebook-js-sdk","google.analytics"]},"extends":"../src/tsconfig.json","files":["../src/webpack.d.ts","../src/declarations.d.ts"]},"resolved":{"compileOnSave":false,"configFileSpecs":{"excludeSpecs":[...],"filesSpecs":[...],"validatedExcludeSpecs":[...],"wildcardDirectories":{}},"errors":[],"fileNames":[...],"options":{"allowJs":true,"allowSyntheticDefaultImports":true,"baseUrl":".../src","configFilePath":".../jest/jest.tsconfig.json","declaration":false,"esModuleInterop":true,"importHelpers":true,"inlineSourceMap":false,"inlineSources":true,"isolatedModules":true,"jsx":1,"lib":["lib.es2015.d.ts","lib.es2016.d.ts","lib.es2017.d.ts","lib.esnext.d.ts","lib.dom.d.ts","lib.dom.iterable.d.ts"],"maxNodeModuleJsDepth":0,"module":1,"moduleResolution":2,"noEmit":false,"noEmitHelpers":true,"noImplicitAny":true,"noImplicitThis":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"$$ts-jest$$","plugins":[{"name":"typescript-styled-plugin"}],"removeComments":false,"skipLibCheck":true,"sourceMap":true,"strict":true,"strictNullChecks":true,"target":6,"types":["node","facebook-js-sdk","google.analytics"]},"raw":{"compileOnSave":false,"compilerOptions":{"types":["node","facebook-js-sdk","google.analytics"]},"exclude":[...],"extends":"../src/tsconfig.json","files":[...]},"typeAcquisition":{"enable":false,"exclude":[],"include":[]},"wildcardDirectories":{}}},"version":"23.10.2"},"message":"normalized typescript config","sequence":19,"time":"2018-09-27T05:01:11.287Z"}
Issue :
ts-jestcurrently forces the value of the tsconfig optionmoduleto becommonjshere; however, this breaks use cases where both typescript and babel are used to transform code when the babel transform expects its input to still be in module form.There seems to be code that appears intended to support this use case, but it's broken by the loop at the end of
readTsConfigwhich forcibly overrides everything.This issue affects at least
babel-plugin-emotion: emotion-js/emotion#687Disabling it would, of course, require that the user runs babel's transform instead, but the only use case for disabling it is when you have to also run babel anyway.
Expected behavior :
ts-jestto either respect themodulesetting intsconfig, or to have a way to opt out ofts-jest's overriding of themoduleoption.Debug log:
log file content
# content of ts-jest.log : {"context":{"logLevel":20,"namespace":"config","package":"ts-jest","transformerId":1,"tsconfig":{"input":{"compilerOptions":{"types":["node","facebook-js-sdk","google.analytics"]},"extends":"../src/tsconfig.json","files":["../src/webpack.d.ts","../src/declarations.d.ts"]},"resolved":{"compileOnSave":false,"configFileSpecs":{"excludeSpecs":[...],"filesSpecs":[...],"validatedExcludeSpecs":[...],"wildcardDirectories":{}},"errors":[],"fileNames":[...],"options":{"allowJs":true,"allowSyntheticDefaultImports":true,"baseUrl":".../src","configFilePath":".../jest/jest.tsconfig.json","declaration":false,"esModuleInterop":true,"importHelpers":true,"inlineSourceMap":false,"inlineSources":true,"isolatedModules":true,"jsx":1,"lib":["lib.es2015.d.ts","lib.es2016.d.ts","lib.es2017.d.ts","lib.esnext.d.ts","lib.dom.d.ts","lib.dom.iterable.d.ts"],"maxNodeModuleJsDepth":0,"module":1,"moduleResolution":2,"noEmit":false,"noEmitHelpers":true,"noImplicitAny":true,"noImplicitThis":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"$$ts-jest$$","plugins":[{"name":"typescript-styled-plugin"}],"removeComments":false,"skipLibCheck":true,"sourceMap":true,"strict":true,"strictNullChecks":true,"target":6,"types":["node","facebook-js-sdk","google.analytics"]},"raw":{"compileOnSave":false,"compilerOptions":{"types":["node","facebook-js-sdk","google.analytics"]},"exclude":[...],"extends":"../src/tsconfig.json","files":[...]},"typeAcquisition":{"enable":false,"exclude":[],"include":[]},"wildcardDirectories":{}}},"version":"23.10.2"},"message":"normalized typescript config","sequence":19,"time":"2018-09-27T05:01:11.287Z"}(note the
"module":1; it should be"module":6ifesnextwas being respected)Minimal repo :
This comment in an affected plugin's issues links to a reproduction repo: emotion-js/emotion#687 (comment)