Trepp/actions-render-wsq

Jest error: not exiting properly

Closed this issue · 4 comments

Overview

After installing the latest version of jest there appears to be a problem with how the async tests are implemented that are preventing jest from exiting correctly. Please see the output below.

As a temporary measure, the cli command --forceExit was added to the npm test command. This is a patch and should be removed as part of solving the issue.

To demonstrate jest working correctly:

npm checkout releases/v1
rm -rf node_modules
npm install
npm run all

To see the error:

npm checkout main
rm -rf node_modules
npm install
npm run all

Error output

> jest

 PASS  __tests__/github.test.ts
  ✓ runs git commands (46 ms)

::debug::Output from git config is: 
::debug::Error response from git config is: 
::debug::Rendering test1.wsq
::debug::Full path of file is /Users/michael/git/trepp/actions-render-wsq/__tests__/test1.wsq
::debug::Error adding png files: fatal: pathspec '*png' did not match any files%0A
::debug::Rendering test1.wsq
::debug::Full path of file is __tests__/test1.wsq
 PASS  __tests__/main.test.ts
  ✓ renders a diagram (391 ms)
  ✓ renders files using local path (325 ms)
  ✓ throws unknown style (14 ms)

::debug::Rendering test1.wsq
::debug::Full path of file is /Users/michael/git/trepp/actions-render-wsq/__tests__/test1.wsq
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.
Test Suites: 2 passed, 2 total
Tests:       4 passed, 4 total
Snapshots:   0 total
Time:        2.426 s, estimated 3 s
Ran all test suites.

@k1ch This is a super minor issue to look at whenever you have some downtime between tasks. I think the issue is related to the async / await handling within the newer version of jest.

k1ch commented

@mikelax I looked in to it and realized that the issue is not only bounded to async tests! I created a simple test, not async, and got the same behavior from jest.
Suspecting of dependencies, I updated package-lock.json file and that resolves this issue. Should I move ahead and create a PR for it?

Thanks @k1ch yeah please do create the PR.
Nice job researching.

I have noticed this in the usher repo as well, after a period of time meeting in dependbot PRs eventually the lock file needs to be synced again.

Resolved in #80