When trying to run angular unit tests I get the following error:
Cannot find module '@ctrl/ngx-emoji-mart'
Some of the nested modules are using this component to display emojies in text felds. Module is indeed installed and works as expected, unit tests are the only problem.
I found that package.json
for the @ctrl/ngx-emoji-mart
is missing "main" field which suppose to point to the JS entry point for it. And since it is missing JEST is unable to use it. Package includes only TS and MJS files in it, and I tried to use and MJS file as ently point using jest transform in jest.config.js like so
transform: {
"^.+\\.mjs$": "babel-jest",
},
But this did not work. I want to believe there must be a way to configure jest to properly compile TS files into JS when testing, but cannot find any examples of it online.
Alternatively maybe I can just compile all the files in the package into the JS file manually?