You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ts-jest currently forces the value of the tsconfig option module to be commonjshere; 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.
Disabling 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-jest to either respect the module setting in tsconfig, or to have a way to opt out of ts-jest's overriding of the module option.
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":6 if esnext was being respected)
Issue :
ts-jest
currently forces the value of the tsconfig optionmodule
to becommonjs
here; 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
readTsConfig
which 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-jest
to either respect themodule
setting intsconfig
, or to have a way to opt out ofts-jest
's overriding of themodule
option.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":6
ifesnext
was being respected)Minimal repo :
This comment in an affected plugin's issues links to a reproduction repo: emotion-js/emotion#687 (comment)
The text was updated successfully, but these errors were encountered: