I have a UI framework that is maintained by my company. and This library doesn't provide cjm module. instead only provide esm module.
And I aware that this library is not failed to be imported from the test condition running by jest.
through some gogooling, I found that the Jest doesn't support ESM module import, and it is only on experimental stage to support esm module on Jest(https://jestjs.io/docs/ecmascript-modules). So I tried to make my library as cjs module version, and test againg. This is perfectly works. So I convinced that the previous bug was caused because Jest doesn't support esm module import.
But at this point, I wonder something below.
-
If Jest don't support ESM, every library should have cjs module regardless of providing esm module??
-
Jest always find only cjs module from libraries?
-
How React test works on jest? even thought every react component and other modules are ESM? This is why we need react-test-renderer or babel-jest as dependencies for the react test?
-
Finally, There is some resources that I can find some information about this subject??
Aucun commentaire:
Enregistrer un commentaire