jest-preset-angular: jest tests keep failing after upgrade to angular 13 and following the migration guide

Version

11.1.1

Steps to reproduce

Hello,

Upgraded an existing angular application from v12.2.0 to 13.2.7. After the angular upgrade tests were failing so i followed the Migration steps from Angular < 13 guide and made the changes according the angular 13 example app. Using jest 28.0.0-alpha.8. When running ‘node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-esm.config.mjs --no-cache’ all my tests keep failing with the same following error =>

Test suite failed to run TypeError: Cannot read properties of undefined (reading ‘html’) at new JSDOMEnvironment (node_modules/jest-environment-jsdom/build/index.js:72:44)

Kind regards,

Gerry

Expected behavior

Running my tests should not give any errors after the upgrade to angular 13.

Actual behavior

All my tests are failing after upgrading from angular 12 to 13. Even after making the changes like it has be done in the angular 13 example app.

Additional context

No response

Environment

System:
    OS: Windows 10 10.0.19042
    CPU: (8) x64 Intel(R) Core(TM) i5-8365U CPU @ 1.60GHz
Binaries:
    Node: 16.13.1 - C:\Program Files\nodejs\node.EXE     
    npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD
npmPackages:
    jest: 28.0.0-alpha.8 => 28.0.0-alpha.8 

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 28

Commits related to this issue

Most upvoted comments

To fix this issue, I had to:

  1. install jest-environment-jsdom
  2. update jest-preset-angular to 12.1.0-next.0

Thanks a lot to all the contributors 😉

Hello guys !

I have the same problem than @innoveltec 's first post. I am using jest 28.0.3 and jest-preset-angular 11.1.2 and the error TypeError: Cannot read properties of undefined (reading 'html') is happening. If i come back to jest 27.5.1 others problems occurs. My test were perfectly working before migrating to Angular 13 and i’m a bit lost actually.

Does someone found a solution ?

Thanks.

Would you guys pls provide a test case to how to use that library to the example app? That would help a lot.