Vitest x Ix components

We are now starting a new project using Angular 21 and the new test framework is Vitest.

I notice that every time I use an Ix component as dependency the test fails.

 FAIL   my-app  src/app/pages/page1/page1.spec.ts [ src/app/pages/page1/page1.spec.ts ]
TypeError: Cannot convert undefined or null to object
 ❯ node_modules/@siemens/ix/components/p-D-__gyet.js:128:124
 ❯ node_modules/@siemens/ix/components/p-D-__gyet.js:128:201
 ❯ src/app/pages/page1/page1.ts:2:1

I tried to trace the error and it goes to this line from any Ix component. E.g:

node_modules/@siemens/ix/components/p-D-__gyet.js:128:124

var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;

We need help here.

Sorry for insisting on this, but I could really use some feedbacks here since my pipeline is broken.

Just so you can understand the whole context here: everytime I use Ix components in my application the correspondent unit tests get this strange error:

TypeError: Cannot convert undefined or null to object.

You can see it in more details in my first post above.

Hello @evertoncanez_ferreira_da_silva,

Here is are some possible fixes:

  1. Switch to happy-dom for better browser API compatibility
  2. Configure JSDOM to Mock adoptedStyleSheets

Hope that helps