New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jest-environment-node

Package Overview
Dependencies
Maintainers
6
Versions
275
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-environment-node - npm Package Compare versions

Comparing version 28.0.0-alpha.9 to 28.0.0-alpha.10

53

build/index.js

@@ -61,6 +61,22 @@ 'use strict';

'ArrayBuffer',
'Uint8Array'
'Uint8Array', // if env is loaded within a jest test
'jest-symbol-do-not-touch'
]);
const nodeGlobals = new Set(
Object.getOwnPropertyNames(globalThis).filter(global => !denyList.has(global))
const nodeGlobals = new Map(
Object.getOwnPropertyNames(globalThis)
.filter(global => !denyList.has(global))
.map(nodeGlobalsKey => {
const descriptor = Object.getOwnPropertyDescriptor(
globalThis,
nodeGlobalsKey
);
if (!descriptor) {
throw new Error(
`No property descriptor for ${nodeGlobalsKey}, this is a bug in Jest.`
);
}
return [nodeGlobalsKey, descriptor];
})
);

@@ -84,6 +100,31 @@

for (const nodeGlobalsKey of nodeGlobals) {
for (const [nodeGlobalsKey, descriptor] of nodeGlobals) {
if (!contextGlobals.has(nodeGlobalsKey)) {
// @ts-expect-error
global[nodeGlobalsKey] = globalThis[nodeGlobalsKey];
Object.defineProperty(global, nodeGlobalsKey, {
configurable: descriptor.configurable,
enumerable: descriptor.enumerable,
get() {
// @ts-expect-error
const val = globalThis[nodeGlobalsKey]; // override lazy getter
Object.defineProperty(global, nodeGlobalsKey, {
configurable: descriptor.configurable,
enumerable: descriptor.enumerable,
value: val,
writable: descriptor.writable
});
return val;
},
set(val) {
// override lazy getter
Object.defineProperty(global, nodeGlobalsKey, {
configurable: descriptor.configurable,
enumerable: descriptor.enumerable,
value: val,
writable: true
});
}
});
}

@@ -90,0 +131,0 @@ }

4

package.json
{
"name": "jest-environment-node",
"version": "28.0.0-alpha.9",
"version": "28.0.0-alpha.10",
"repository": {

@@ -36,3 +36,3 @@ "type": "git",

},
"gitHead": "7c63f5981eb20d4b89a4c04f3675e0050d8d7887"
"gitHead": "d5eda7f23571081cea24760261d209ff3e01a084"
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc