Jest angular @jsonforms/angular-material

Using Jest to write unit tests but it failed because it can not find the module@jsonforms/angular-material. Is it possible to configure it so the custom component can be tested? I read the reason is for AMD module but do you have any idea how I can resolve this?

Hi @daniela,

This is hard to diagnose from afar and seems rather to be a generic Angular question. You might want to look at our test setup for angular-material for inspiration.

Generally speaking you need to make sure that all used components are available in your test environment.

jest have a problem with AMD modules. In the example, I see that it is used karma. I can send how I have configured jest but I received error when I ran the test “Cannot find module '@jsonforms/angular”.

Hi @daniela,

We don’t publish AMD modules. We are publishing in FESM format, see here. Before that (<3.2) we published in CJS and ESM.

Yes you are right. Sorry for that but I still received that “Cannot find module '@jsonforms/angular”. Do you have any idea why just when I run the test I get this error?

I try also with “moduleNameMapper”: {
“^@jsonforms/angular$”: “/node_modules/@jsonforms/angular/index.js”
} but still received the error that the module can not be found.

for angular/core it is working but for @jsonforms/angular-material @jsonforms/angula return error