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 open handle in tests #4596

Closed
jeddy3 opened this issue Feb 13, 2020 · 2 comments · Fixed by #4601
Closed

Fix open handle in tests #4596

jeddy3 opened this issue Feb 13, 2020 · 2 comments · Fixed by #4601
Labels
status: ready to implement is ready to be worked on by someone type: tests an improvement to testing

Comments

@jeddy3
Copy link
Member

jeddy3 commented Feb 13, 2020

I got this while running our tests:

Running coverage on untested files...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 --runInBand --detectOpenHandles to find leaks.

And the following:

npm run jest -- --runInBand --detectOpenHandles

Returns:

Jest has detected the following 1 open handle potentially keeping Jest from exiting:

  ●  TTYWRAP

      14 | 
      15 |      beforeAll(() => {
    > 16 |              processRestore = { ...process };
         |              ^
      17 |              logRestore = { ...console };
      18 |              process.exit = (exitCode) => (process.exitCode = exitCode);
      19 |      });

      at Object.<anonymous> (system-tests/cli/cli.test.js:16:3)
@jeddy3 jeddy3 added status: ready to implement is ready to be worked on by someone type: tests an improvement to testing labels Feb 13, 2020
hudochenkov added a commit that referenced this issue Feb 13, 2020
hudochenkov added a commit that referenced this issue Feb 13, 2020
hudochenkov added a commit that referenced this issue Feb 13, 2020
jeddy3 pushed a commit that referenced this issue Feb 14, 2020
jeddy3 pushed a commit that referenced this issue Feb 14, 2020
@exoer
Copy link

exoer commented Mar 8, 2020

I got this while running our tests:

Running coverage on untested files...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 --runInBand --detectOpenHandles to find leaks.

And the following:

npm run jest -- --runInBand --detectOpenHandles

Returns:

Jest has detected the following 1 open handle potentially keeping Jest from exiting:

  ●  TTYWRAP

      14 | 
      15 |      beforeAll(() => {
    > 16 |              processRestore = { ...process };
         |              ^
      17 |              logRestore = { ...console };
      18 |              process.exit = (exitCode) => (process.exitCode = exitCode);
      19 |      });

      at Object.<anonymous> (system-tests/cli/cli.test.js:16:3)

@jeddy3 You might want to try something like this

afterAll(()=>{
   processRestore = null
    ...
})

@jeddy3
Copy link
Member Author

jeddy3 commented Mar 8, 2020

@exoer Thanks for the suggestion. @hudochenkov refactored these tests in #4601 and I believe the issue was resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready to implement is ready to be worked on by someone type: tests an improvement to testing
Development

Successfully merging a pull request may close this issue.

2 participants