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

fix: add detectOpenHandles flag in tests (jest) #285

Merged
merged 3 commits into from
Mar 3, 2023
Merged

Conversation

Imod7
Copy link
Collaborator

@Imod7 Imod7 commented Feb 28, 2023

Issue

While running the tests with the command yarn run test I got this message at the end :

A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them.

Solution

So I added the suggested --detectOpenHandles option to the jest's related scripts in package.json file. I then run the tests again and the message is no longer appearing.

@Imod7 Imod7 requested a review from a team as a code owner February 28, 2023 18:55
@TarikGul
Copy link
Member

This has been an ongoing issue but the jest tests fail in the CI for some odd reason sometimes. Not sure if its a memory issue, if the metadata files are too large etc..

It takes a few reruns of the action and then it passes. Really odd.

Other than that, love the PR.

@Imod7 Imod7 requested a review from a team as a code owner March 1, 2023 15:10
@Imod7
Copy link
Collaborator Author

Imod7 commented Mar 1, 2023

This has been an ongoing issue but the jest tests fail in the CI for some odd reason sometimes. Not sure if its a memory issue, if the metadata files are too large etc..

It takes a few reruns of the action and then it passes. Really odd.

Other than that, love the PR.

Thank you for re-running @TarikGul.

I pushed another commit after noticing in Actions under Get yarn cache directory path this warning :

Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: [https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/](https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/)

I checked the mentioned (in the warning) link and based on the example :
this

- name: Set output
  run: echo "::set-output name={name}::{value}"

becomes

- name: Set output
  run: echo "{name}={value}" >> $GITHUB_OUTPUT

So in our pr.yml I changed the three entries :

run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

to this

run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

accordingly

@TarikGul
Copy link
Member

TarikGul commented Mar 1, 2023

@Imod7 Really great catch! Looks great to me!

@Imod7 Imod7 merged commit 90a231e into main Mar 3, 2023
@Imod7 Imod7 deleted the domi-add-jest-flag branch March 3, 2023 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants