Skip to content

Commit 6a68a13

Browse files
Do not collect SIGNREQUEST as open handles (#12789)
1 parent 1dee273 commit 6a68a13

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
### Fixes
88

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

1112
### Chore & Maintenance
1213

packages/jest-core/src/__tests__/collectHandles.test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*
77
*/
88

9+
import crypto from 'crypto';
910
import {promises as dns} from 'dns';
1011
import http from 'http';
1112
import {PerformanceObserver} from 'perf_hooks';
@@ -67,6 +68,22 @@ describe('collectHandles', () => {
6768
);
6869
});
6970

71+
it('should not collect the SIGNREQUEST open handle', async () => {
72+
const handleCollector = collectHandles();
73+
74+
const key =
75+
'-----BEGIN PRIVATE KEY-----\r\nMC4CAQAwBQYDK2VwBCIEIHKj+sVa9WcD' +
76+
'/q2DJUJaf43Kptc8xYuUQA4bOFj9vC8T\r\n-----END PRIVATE KEY-----';
77+
const data = Buffer.from('a');
78+
crypto.sign(null, data, key);
79+
80+
const openHandles = await handleCollector();
81+
82+
expect(openHandles).not.toContainEqual(
83+
expect.objectContaining({message: 'SIGNREQUEST'}),
84+
);
85+
});
86+
7087
it('should collect handles opened in test functions with `done` callbacks', done => {
7188
const handleCollector = collectHandles();
7289
const server = http.createServer((_, response) => response.end('ok'));

packages/jest-core/src/collectHandles.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ export default function collectHandles(): HandleCollectionResult {
7272
type === 'PerformanceObserver' ||
7373
type === 'RANDOMBYTESREQUEST' ||
7474
type === 'DNSCHANNEL' ||
75-
type === 'ZLIB'
75+
type === 'ZLIB' ||
76+
type === 'SIGNREQUEST'
7677
) {
7778
return;
7879
}

0 commit comments

Comments
 (0)