Socket
Socket
Sign inDemoInstall

jest-environment-node

Package Overview
Dependencies
Maintainers
3
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 29.7.0 to 30.0.0-alpha.1

build/index.mjs

6

build/index.d.ts

@@ -11,3 +11,3 @@ /**

import type {EnvironmentContext} from '@jest/environment';
import type {Global} from '@jest/types';
import type {Global as Global_2} from '@jest/types';
import type {JestEnvironment} from '@jest/environment';

@@ -23,6 +23,6 @@ import type {JestEnvironmentConfig} from '@jest/environment';

fakeTimersModern: ModernFakeTimers | null;
global: Global.Global;
global: Global_2.Global;
moduleMocker: ModuleMocker | null;
customExportConditions: string[];
private _configuredExportConditions?;
private readonly _configuredExportConditions?;
constructor(config: JestEnvironmentConfig, _context: EnvironmentContext);

@@ -29,0 +29,0 @@ setup(): Promise<void>;

@@ -1,9 +0,23 @@

'use strict';
/*!
* /**
* * Copyright (c) Meta Platforms, Inc. and affiliates.
* *
* * This source code is licensed under the MIT license found in the
* * LICENSE file in the root directory of this source tree.
* * /
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
(() => {
var exports = __webpack_exports__;
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", ({
value: true
});
exports.default = exports.TestEnvironment = void 0;
}));
exports["default"] = exports.TestEnvironment = void 0;
function _vm() {
const data = require('vm');
const data = require("vm");
_vm = function () {

@@ -15,3 +29,3 @@ return data;

function _fakeTimers() {
const data = require('@jest/fake-timers');
const data = require("@jest/fake-timers");
_fakeTimers = function () {

@@ -23,3 +37,3 @@ return data;

function _jestMock() {
const data = require('jest-mock');
const data = require("jest-mock");
_jestMock = function () {

@@ -31,3 +45,3 @@ return data;

function _jestUtil() {
const data = require('jest-util');
const data = require("jest-util");
_jestUtil = function () {

@@ -46,29 +60,12 @@ return data;

// some globals we do not want, either because deprecated or we set it ourselves
const denyList = new Set([
'GLOBAL',
'root',
'global',
'globalThis',
'Buffer',
'ArrayBuffer',
'Uint8Array',
// if env is loaded within a jest test
'jest-symbol-do-not-touch'
]);
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];
})
);
const denyList = new Set(['GLOBAL', 'root', 'global', 'globalThis', 'Buffer', 'ArrayBuffer', 'Uint8Array',
// if env is loaded within a jest test
'jest-symbol-do-not-touch']);
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];
}));
function isString(value) {

@@ -88,8 +85,7 @@ return typeof value === 'string';

constructor(config, _context) {
const {projectConfig} = config;
const {
projectConfig
} = config;
this.context = (0, _vm().createContext)();
const global = (0, _vm().runInContext)(
'this',
Object.assign(this.context, projectConfig.testEnvironmentOptions)
);
const global = (0, _vm().runInContext)('this', Object.assign(this.context, projectConfig.testEnvironmentOptions));
this.global = global;

@@ -142,4 +138,2 @@ const contextGlobals = new Set(Object.getOwnPropertyNames(global));

}
// @ts-expect-error - Buffer and gc is "missing"
global.global = global;

@@ -158,12 +152,9 @@ global.Buffer = Buffer;

if ('customExportConditions' in projectConfig.testEnvironmentOptions) {
const {customExportConditions} = projectConfig.testEnvironmentOptions;
if (
Array.isArray(customExportConditions) &&
customExportConditions.every(isString)
) {
const {
customExportConditions
} = projectConfig.testEnvironmentOptions;
if (Array.isArray(customExportConditions) && customExportConditions.every(isString)) {
this._configuredExportConditions = customExportConditions;
} else {
throw new Error(
'Custom export conditions specified but they are not an array of strings'
);
throw new Error('Custom export conditions specified but they are not an array of strings');
}

@@ -217,4 +208,8 @@ }

}
exports.default = NodeEnvironment;
const TestEnvironment = NodeEnvironment;
exports.TestEnvironment = TestEnvironment;
exports["default"] = NodeEnvironment;
const TestEnvironment = exports.TestEnvironment = NodeEnvironment;
})();
module.exports = __webpack_exports__;
/******/ })()
;
{
"name": "jest-environment-node",
"version": "29.7.0",
"version": "30.0.0-alpha.1",
"repository": {

@@ -15,2 +15,4 @@ "type": "git",

"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"

@@ -21,14 +23,14 @@ },

"dependencies": {
"@jest/environment": "^29.7.0",
"@jest/fake-timers": "^29.7.0",
"@jest/types": "^29.6.3",
"@jest/environment": "30.0.0-alpha.1",
"@jest/fake-timers": "30.0.0-alpha.1",
"@jest/types": "30.0.0-alpha.1",
"@types/node": "*",
"jest-mock": "^29.7.0",
"jest-util": "^29.7.0"
"jest-mock": "30.0.0-alpha.1",
"jest-util": "30.0.0-alpha.1"
},
"devDependencies": {
"@jest/test-utils": "^29.7.0"
"@jest/test-utils": "30.0.0-alpha.1"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
"node": "^16.10.0 || ^18.12.0 || >=20.0.0"
},

@@ -38,3 +40,3 @@ "publishConfig": {

},
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630"
"gitHead": "d005cb2505c041583e0c5636d006e08666a54b63"
}
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