Reputation: 660
While updating our project from Angular 13 to 15, we ran into an issue with all of our tests failing due to error:
FAIL src/app/app.component.spec.ts
● Test suite failed to run
TypeError: Cannot redefine property: transform
at Function.defineProperty (<anonymous>)
16 | });
17 |
> 18 | Object.defineProperty(document.body.style, 'transform', {
| ^
19 | value: () => {
20 | return {
21 | enumerable: true,
at Object.<anonymous> (setup-jest.ts:18:8)
I tracked down the issue to zone.js v0.13.1+. This bug ticket points to the root of the problem. I'm seeing their workaround near the bottom, but I'd prefer to not use them if possible (and I can't say for sure if that workaround would work in my case as the error is pointing to the setup-jest file, not a spyOn in test file). Can anyone recommend how to solve this so that we'll be able to update above the 0.13.9 version and eventually 0.14 when we goto jest 29 & angular 16?
Upvotes: 0
Views: 727