Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Jest open handles after upgrade from angular v12 to v13 #1426

Open
SimonMueller opened this issue Apr 27, 2022 · 19 comments
Open

[Bug]: Jest open handles after upgrade from angular v12 to v13 #1426

SimonMueller opened this issue Apr 27, 2022 · 19 comments
Labels
🤷‍♂️ Needs More Info waiting for more information from author of the issue Upstream Bug

Comments

@SimonMueller
Copy link

Version

11.1.2

Steps to reproduce

  1. Clone https://github.com/SimonMueller/jest-preset-angular-open-handle-reproduction
  2. Run npm i
  3. Run npm t
  4. See test output

Expected behavior

No open handles after tests are done executing.

Actual behavior

Two open handles after tests are done executing. See screenshot:
image

Additional context

We saw this behavior after upgrading from angular 12 where these open handles are not present. I tested this aswell with the repo above.

Environment

System:
    OS: Linux 5.15 Ubuntu 22.04 LTS 22.04 (Jammy Jellyfish)
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
  Binaries:
    Node: 14.19.1 - ~/.nvm/versions/node/v14.19.1/bin/node
    npm: 6.14.16 - ~/.nvm/versions/node/v14.19.1/bin/npm
  npmPackages:
    jest: 27.5.1 => 27.5.1
@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 27, 2022

Not sure if we can do anything in this case. This is the only way to set up test environment to work with Angular. You can also copy the file content and put it in your own setupJest.ts. The file is just a convenient way for users to use.

@SimonMueller
Copy link
Author

Hi @ahnpnl

Thanks for your fast response 👍

Can you please elaborate on what you think is the problem and which files you mean exactly?
So is this a known issue / bug?

Regards

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 27, 2022

The file is here https://github.com/thymikee/jest-preset-angular/blob/main/src/config/setup-jest.ts

i think this is an existing issue already as I saw this in the past as well. Idk what the problem can be tbh. I never check this 😅

@SimonMueller
Copy link
Author

SimonMueller commented Apr 27, 2022

So you think the problem is with angular v13?

What i find special is that it is only after the upgrade from angular v12 to v13 and i have never seen it before since angular v11.

We had some failing tests where this seems to be the cause which is not really nice for us. And as we can reproduce it with such a simple example i think it would be good to have a look at it.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 27, 2022

image

seem like this is the issue. It comes from getTestBed

@SimonMueller
Copy link
Author

i created an issue in the angular/core repository. lets see if they have some insights.

@marvincayetano
Copy link

marvincayetano commented May 17, 2022

@SimonMueller Seems like you got an answer from the Angular team
Andrew from angular tried fixing this bug.

AndrewKushnir solution

@borjapazr
Copy link

It seems that the problem is related to this library, not to Angular.

angular/angular#45776 (comment)

@Bil0
Copy link

Bil0 commented Aug 18, 2022

Hello, same error with angular v14
image

@cangomescisco
Copy link

+1

@MaximeKoitsalu
Copy link

Currently facing the same warnings with Angular 14.2.0 and "jest-preset-angular": "^12.2.2"

@JamesODonoghue
Copy link

+1

5 similar comments
@adoroshenko-lohika-tix
Copy link

adoroshenko-lohika-tix commented Nov 10, 2022

+1

@ialterovych-lohika-tix
Copy link

+1

@estrudels
Copy link

+1

@georgevbm
Copy link

+1

@rajeshkumaravel
Copy link

+1

@leobrines
Copy link

same here with Angular "^14.1.0" and jest-preset-angular "^12.2.0"

@jseashell
Copy link

+1, Angular ^13.2.3 and jest-preset-angular ^11.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤷‍♂️ Needs More Info waiting for more information from author of the issue Upstream Bug
Projects
None yet
Development

No branches or pull requests