paritytech / txwrapper-core

Tools for FRAME chain builders to publish chain specific offline transaction generation libraries.
https://paritytech.github.io/txwrapper-core/
Apache License 2.0
77 stars 28 forks source link

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

Closed Imod7 closed 1 year ago

Imod7 commented 1 year ago

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.

TarikGul commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@Imod7 Really great catch! Looks great to me!