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]: SIGNREQUEST incorrectly detected as an open handle #12775

Closed
cristianrgreco opened this issue Apr 29, 2022 · 4 comments · Fixed by #12789
Closed

[Bug]: SIGNREQUEST incorrectly detected as an open handle #12775

cristianrgreco opened this issue Apr 29, 2022 · 4 comments · Fixed by #12789

Comments

@cristianrgreco
Copy link
Contributor

cristianrgreco commented Apr 29, 2022

Version

28.0.3

Steps to reproduce

Run the following test via jest --detectOpenHandles:

const crypto = require('crypto');

test('should not detect open handles', () => {
  const key =
    '-----BEGIN PRIVATE KEY-----\r\nMC4CAQAwBQYDK2VwBCIEIHKj+sVa9WcD'
    + '/q2DJUJaf43Kptc8xYuUQA4bOFj9vC8T\r\n-----END PRIVATE KEY-----';

  const data = Buffer.from('a');

  const sig = crypto.sign(null, data, key);
});

Expected behavior

crypto.sign is a synchronous operation. Once the test completes, I would expect Jest to not detect any open handles.

Actual behavior

An open handle is detected:

> jest "--detectOpenHandles"

 PASS  ./test.js
  ✓ should not detect open handles (2 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        0.12 s, estimated 1 s
Ran all test suites.

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

  ●  SIGNREQUEST

       8 |   const data = Buffer.from('a');
       9 |
    > 10 |   const sig = crypto.sign(null, data, key);
         |                      ^
      11 | });
      12 |
      13 |

      at Object.sign (test.js:10:22)
      at TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:317:13)
      at runJest (node_modules/@jest/core/build/runJest.js:407:19)
      at _run10000 (node_modules/@jest/core/build/cli/index.js:338:7)
      at runCLI (node_modules/@jest/core/build/cli/index.js:190:3)

Additional context

No response

Environment

System:
  OS: Mac OS X 12.3.1 (21E258) / Ubuntu 20.04.4 LTS
  CPU: Apple M1 Max
Binaries:
  Node: v16.13.1 / v17.3.0
  NPM: 8.1.2
@cristianrgreco
Copy link
Contributor Author

@SimenB Sure! Here it is: #12789.

@SimenB
Copy link
Member

SimenB commented May 6, 2022

https://github.com/facebook/jest/releases/tag/v28.1.0

@github-actions
Copy link

github-actions bot commented Jun 6, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants