Socket
Socket
Sign inDemoInstall

jest-leak-detector

Package Overview
Dependencies
6
Maintainers
5
Versions
164
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 28.1.3 to 29.0.0-alpha.0

33

build/index.js

@@ -81,33 +81,10 @@ 'use strict';

);
} // TODO: Remove the `if` and `weak-napi` when we drop node 12, as v14 supports FinalizationRegistry
} // When `_finalizationRegistry` is GCed the callback we set will no longer be called,
if (globalThis.FinalizationRegistry) {
// When `_finalizationRegistry` is GCed the callback we set will no longer be called,
// so we need to assign it to `this` to keep it referenced
this._finalizationRegistry = new FinalizationRegistry(() => {
this._isReferenceBeingHeld = false;
});
this._finalizationRegistry = new FinalizationRegistry(() => {
this._isReferenceBeingHeld = false;
});
this._finalizationRegistry.register(value, undefined);
} else {
let weak;
this._finalizationRegistry.register(value, undefined);
try {
// eslint-disable-next-line import/no-extraneous-dependencies
weak = require('weak-napi');
} catch (err) {
if (!err || err.code !== 'MODULE_NOT_FOUND') {
throw err;
}
throw new Error(
'The leaking detection mechanism requires newer version of node that supports ' +
'FinalizationRegistry, update your node or install the "weak-napi" package ' +
'which support current node version as a dependency on your main project.'
);
}
weak(value, () => (this._isReferenceBeingHeld = false));
}
this._isReferenceBeingHeld = true; // Ensure value is not leaked by the closure created by the "weak" callback.

@@ -114,0 +91,0 @@

14

package.json
{
"name": "jest-leak-detector",
"version": "28.1.3",
"version": "29.0.0-alpha.0",
"repository": {

@@ -20,11 +20,7 @@ "type": "git",

"dependencies": {
"jest-get-type": "^28.0.2",
"pretty-format": "^28.1.3"
"jest-get-type": "^29.0.0-alpha.0",
"pretty-format": "^29.0.0-alpha.0"
},
"devDependencies": {
"@types/weak-napi": "^2.0.0",
"weak-napi": "^2.0.1"
},
"engines": {
"node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0"
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
},

@@ -34,3 +30,3 @@ "publishConfig": {

},
"gitHead": "2cce069800dab3fc8ca7c469b32d2e2b2f7e2bb1"
"gitHead": "6862afb00307b52f32eedee977a9b3041355f184"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc