jest-environment-node
Advanced tools
+1
-3
@@ -8,3 +8,3 @@ /** | ||
| import {Context} from 'vm'; | ||
| import {Context} from 'node:vm'; | ||
| import { | ||
@@ -43,3 +43,1 @@ EnvironmentContext, | ||
| }; | ||
| export {}; |
+28
-7
@@ -21,5 +21,5 @@ /*! | ||
| exports["default"] = exports.TestEnvironment = void 0; | ||
| function _vm() { | ||
| const data = require("vm"); | ||
| _vm = function () { | ||
| function _nodeVm() { | ||
| const data = require("node:vm"); | ||
| _nodeVm = function () { | ||
| return data; | ||
@@ -68,2 +68,7 @@ }; | ||
| 'jest-symbol-do-not-touch']); | ||
| // Storage proxies (Node 25+) emit a warning on any Reflect.get access when | ||
| // --localstorage-file is not set. We install them as non-caching passthrough | ||
| // getters so they never land in GlobalProxy.propertyToValue and are never | ||
| // inspected by deleteProperties at teardown. | ||
| const storageGlobals = new Set(['localStorage', 'sessionStorage']); | ||
| const nodeGlobals = new Map(Object.getOwnPropertyNames(globalThis).filter(global => !denyList.has(global)).map(nodeGlobalsKey => { | ||
@@ -107,13 +112,29 @@ const descriptor = Object.getOwnPropertyDescriptor(globalThis, nodeGlobalsKey); | ||
| this._globalProxy = new GlobalProxy(); | ||
| this.context = (0, _vm().createContext)(this._globalProxy.proxy()); | ||
| const global = (0, _vm().runInContext)('this', Object.assign(this.context, projectConfig.testEnvironmentOptions)); | ||
| this.context = (0, _nodeVm().createContext)(this._globalProxy.proxy()); | ||
| const global = (0, _nodeVm().runInContext)('this', Object.assign(this.context, projectConfig.testEnvironmentOptions)); | ||
| this.global = global; | ||
| const contextGlobals = new Set(Object.getOwnPropertyNames(global)); | ||
| for (const [nodeGlobalsKey, descriptor] of nodeGlobals) { | ||
| (0, _jestUtil().protectProperties)(globalThis[nodeGlobalsKey]); | ||
| if (!storageGlobals.has(nodeGlobalsKey)) { | ||
| (0, _jestUtil().protectProperties)(globalThis[nodeGlobalsKey]); | ||
| } | ||
| if (!contextGlobals.has(nodeGlobalsKey)) { | ||
| if (descriptor.configurable) { | ||
| if (storageGlobals.has(nodeGlobalsKey)) { | ||
| Object.defineProperty(global, nodeGlobalsKey, { | ||
| configurable: true, | ||
| enumerable: descriptor.enumerable, | ||
| get: () => globalThis[nodeGlobalsKey], | ||
| set(value) { | ||
| Object.defineProperty(global, nodeGlobalsKey, { | ||
| configurable: true, | ||
| enumerable: descriptor.enumerable, | ||
| value, | ||
| writable: true | ||
| }); | ||
| } | ||
| }); | ||
| } else if (descriptor.configurable) { | ||
| Object.defineProperty(global, nodeGlobalsKey, { | ||
| configurable: true, | ||
| enumerable: descriptor.enumerable, | ||
| get() { | ||
@@ -120,0 +141,0 @@ const value = globalThis[nodeGlobalsKey]; |
+9
-9
| { | ||
| "name": "jest-environment-node", | ||
| "version": "30.3.0", | ||
| "version": "30.4.0", | ||
| "repository": { | ||
@@ -22,12 +22,12 @@ "type": "git", | ||
| "dependencies": { | ||
| "@jest/environment": "30.3.0", | ||
| "@jest/fake-timers": "30.3.0", | ||
| "@jest/types": "30.3.0", | ||
| "@jest/environment": "30.4.0", | ||
| "@jest/fake-timers": "30.4.0", | ||
| "@jest/types": "30.4.0", | ||
| "@types/node": "*", | ||
| "jest-mock": "30.3.0", | ||
| "jest-util": "30.3.0", | ||
| "jest-validate": "30.3.0" | ||
| "jest-mock": "30.4.0", | ||
| "jest-util": "30.4.0", | ||
| "jest-validate": "30.4.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@jest/test-utils": "30.3.0", | ||
| "@jest/test-utils": "30.4.0", | ||
| "clsx": "^2.1.1" | ||
@@ -48,3 +48,3 @@ }, | ||
| }, | ||
| "gitHead": "efb59c2e81083f8dc941f20d6d20a3af2dc8d068" | ||
| "gitHead": "5cbb21e0b3037edb42e503ec1a1ce80efad40c20" | ||
| } |
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
15532
6.41%389
5.42%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated
Updated
Updated