Closed TimoPot closed 1 year ago
Thanks for reporting this issue @TimoPot. What version of Jest are you using in your app?
This is strange, the BrSdkModule is exported the same way in both 18 & 19.
Depending on which version of angular you are using Jest needs a different way of using ES Modules,have you taken this into account in your test setup?
Hi @TimoPot, the ng-sdk v18 is compiled using Angular 11 and v19 is compiled using Angular 15. If your project is running Angular 14+ then you will need the v19 version of the SDK. I don't know your jest setup, but if you are using @angular-builders/jest
(which I highly recommend), make sure you have the correct version installed:
If you don't use that package, you must run ngcc before the tests.
Thanks guys. I will look into it.
@TimoPot Hey, Timo! Any update on this, curious if you had a chance to figure out what is causing the issue? Thanks!
I forgot to tell that it is in a NX monorepo. I have updated all jest related packages without any luck.
Then I created an new empty nx project v14 and copied all this settings and package versions.
Still getting errors.
For now its on hold until I recover from the flu.
I forgot to tell that it is in a NX monorepo. I have updated all jest related packages without any luck.
Then I created an new empty nx project v14 and copied all this settings and package versions.
Still getting errors.
For now its on hold until I recover from the flu.
Hi @TimoPot, I tried to reproduce the error in an empty NX project v14 and I got the same error. The problem is that Angular 13+ doesn't create commonjs bundles anymore, only ESM bundles. Sadly, I don't have much experience using NX so I'm not sure what's the best way to fix it.
Anyways, the error doesn't seem related to the library itself but rather how NX + Jest handles ESM libraries.
@TimoPot I believe this issue is at cause here: https://github.com/nrwl/nx/issues/12046
Issues is resolved. I'm not sure what the issue was. I updated Jest and everything related to Jest and I updated the jest config files.
To make sure I got a clean install of npm I removed the node_modules, the npm cache and the package-lock.json
Good to hear that you managed to fix the issue in the end, @TimoPot. Thanks for let us know.
I've upgrade the Bloomreach dependencies to "version": "19.0.2",
Now when running Jest tests I get the error below. This does not happen when I downgrade to v18 of the ng-sdk.
FAIL src/app/app.component.spec.ts ● Test suite failed to run