Skip to content

Commit

Permalink
ignore correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed May 18, 2021
1 parent 07e885f commit fc0262e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/jest-core/src/collectHandles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function stackIsFromUser(stack: string) {

const alwaysActive = () => true;

// @ts-expect-error: doesn't exist in v10 typings
const hasWeakRef = typeof WeakRef === 'function';

// Inspired by https://github.com/mafintosh/why-is-node-running/blob/master/index.js
Expand Down Expand Up @@ -75,9 +76,9 @@ export default function collectHandles(): HandleCollectionResult {
// Timer that supports hasRef (Node v11+)
if ('hasRef' in resource) {
if (hasWeakRef) {
// @ts-expect-error: doesn't exist in v10 typings
const ref = new WeakRef(resource);
isActive = () => {
// @ts-expect-error: doesn't exist in v10 typings
return ref.deref()?.hasRef() ?? false;
};
} else {
Expand Down

0 comments on commit fc0262e

Please sign in to comment.