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

Do not collect SIGNREQUEST as open handles #12789

Merged
merged 3 commits into from May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,7 @@
### Fixes

- `[@jest/expect-utils]` Fix deep equality of ImmutableJS Lists ([#12763](https://github.com/facebook/jest/pull/12763))
- `[jest-core]` Do not collect `SIGNREQUEST` as open handles ([#12789](https://github.com/facebook/jest/pull/12789))

### Chore & Maintenance

Expand Down
17 changes: 17 additions & 0 deletions packages/jest-core/src/__tests__/collectHandles.test.js
Expand Up @@ -6,6 +6,7 @@
*
*/

import crypto from 'crypto';
import {promises as dns} from 'dns';
import http from 'http';
import {PerformanceObserver} from 'perf_hooks';
Expand Down Expand Up @@ -67,6 +68,22 @@ describe('collectHandles', () => {
);
});

it('should not collect the SIGNREQUEST open handle', async () => {
const handleCollector = collectHandles();

const key =
'-----BEGIN PRIVATE KEY-----\r\nMC4CAQAwBQYDK2VwBCIEIHKj+sVa9WcD' +
'/q2DJUJaf43Kptc8xYuUQA4bOFj9vC8T\r\n-----END PRIVATE KEY-----';
const data = Buffer.from('a');
crypto.sign(null, data, key);

const openHandles = await handleCollector();

expect(openHandles).not.toContainEqual(
expect.objectContaining({message: 'SIGNREQUEST'}),
);
});

it('should collect handles opened in test functions with `done` callbacks', done => {
const handleCollector = collectHandles();
const server = http.createServer((_, response) => response.end('ok'));
Expand Down
3 changes: 2 additions & 1 deletion packages/jest-core/src/collectHandles.ts
Expand Up @@ -72,7 +72,8 @@ export default function collectHandles(): HandleCollectionResult {
type === 'PerformanceObserver' ||
type === 'RANDOMBYTESREQUEST' ||
type === 'DNSCHANNEL' ||
type === 'ZLIB'
type === 'ZLIB' ||
type === 'SIGNREQUEST'
) {
return;
}
Expand Down