question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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 

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:28

github_iconTop GitHub Comments

6reactions
e-ozcommented, May 17, 2022

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 😉

2reactions
maxens-lpsilcommented, May 3, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular >=13 | jest-preset-angular - GitHub Pages
Migration steps from Angular < 13​. Upgrade the project to Angular 13 following https://update.angular.io/. If one is using the default preset as following:....
Read more >
Developers - jest tests keep failing after upgrade to angular 13 ...
After the angular upgrade tests were failing so i followed the Migration steps from Angular < 13 guide and made the changes according...
Read more >
Angular 13 + jest + Angular library not working - Stack Overflow
I use ngx-pipes, which is a library that is not compiled for Angular 13. It works fine during normal Angular build. But in...
Read more >
jest-preset-angular - npm
These instructions will get you setup to use jest-preset-angular in your project. For more detailed documentation, please check online ...
Read more >
cannot read properties of undefined (reading 'html') at new ...
After the angular upgrade tests were failing so i followed the Migration steps from Angular < 13 guide and made the changes according...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found