Testing applications based on @siemens/ix-react

I am currently experimenting with Siemens Ix. I am using ix-react and try to create a simple app.

While I succeeded authoring an app, I failed to create unittests for my components that are using components from ix-react.

I have tried both vitest and jest, but it seems that node is never able to import the @siemens/ix modules. If I use vitest, node complains that importing directories is not possible. When I use jest, it complains that the modules are imported as cjs modules, but contain import and export statements and therefore need to be imported as esm modules.

I have seen that on github, ix-react itself uses vitest, but I was not able to setup an application project that both uses @siemens/ix-react and has working unit tests for the components.

Any tips how to setup a project that supports both @siemens/ix-react and also unit tests for components containing Ix… components like IxButton?

Hi I prepared some times ago a example repo: Sign in to your account

We will remove commonjs in the next major release. feat(react): remove commonjs support by danielleroux · Pull Request #1326 · siemens/ix · GitHub

Thank you very much for your quick answer!!

I took a look at your repo. I think, the main approach to overcome my issues is to inline @siemens/ix and @siemens/ix-react. By doing this, esbuild will do the module resolution for those two packages (which probably can handle directory imports).

I will try if this solution works for me but it sounds very promising :-D.