Socket
Socket
Sign inDemoInstall

jest-environment-jsdom

Package Overview
Dependencies
149
Maintainers
3
Versions
271
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

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';

@@ -28,3 +28,3 @@ import type {JestEnvironmentConfig} from '@jest/environment';

customExportConditions: string[];
private _configuredExportConditions?;
private readonly _configuredExportConditions?;
constructor(config: JestEnvironmentConfig, context: EnvironmentContext);

@@ -41,3 +41,3 @@ setup(): Promise<void>;

declare type Win = Window &
Global.Global & {
Global_2.Global & {
Error: {

@@ -44,0 +44,0 @@ stackTraceLimit: number;

@@ -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 _jsdom() {
const data = require('jsdom');
const data = require("jsdom");
_jsdom = 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 () {

@@ -60,3 +74,5 @@ return data;

constructor(config, context) {
const {projectConfig} = config;
const {
projectConfig
} = config;
const virtualConsole = new (_jsdom().VirtualConsole)();

@@ -69,21 +85,13 @@ virtualConsole.sendTo(context.console, {

});
this.dom = new (_jsdom().JSDOM)(
typeof projectConfig.testEnvironmentOptions.html === 'string'
? projectConfig.testEnvironmentOptions.html
: '<!DOCTYPE html>',
{
pretendToBeVisual: true,
resources:
typeof projectConfig.testEnvironmentOptions.userAgent === 'string'
? new (_jsdom().ResourceLoader)({
userAgent: projectConfig.testEnvironmentOptions.userAgent
})
: undefined,
runScripts: 'dangerously',
url: 'http://localhost/',
virtualConsole,
...projectConfig.testEnvironmentOptions
}
);
const global = (this.global = this.dom.window);
this.dom = new (_jsdom().JSDOM)(typeof projectConfig.testEnvironmentOptions.html === 'string' ? projectConfig.testEnvironmentOptions.html : '<!DOCTYPE html>', {
pretendToBeVisual: true,
resources: typeof projectConfig.testEnvironmentOptions.userAgent === 'string' ? new (_jsdom().ResourceLoader)({
userAgent: projectConfig.testEnvironmentOptions.userAgent
}) : undefined,
runScripts: 'dangerously',
url: 'http://localhost/',
virtualConsole,
...projectConfig.testEnvironmentOptions
});
const global = this.global = this.dom.window;
if (global == null) {

@@ -93,3 +101,3 @@ throw new Error('JSDOM did not return a Window object');

// @ts-expect-error - for "universal" code (code should use `globalThis`)
// TODO: remove at some point - for "universal" code (code should use `globalThis`)
global.global = global;

@@ -131,12 +139,9 @@

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');
}

@@ -192,4 +197,8 @@ }

}
exports.default = JSDOMEnvironment;
const TestEnvironment = JSDOMEnvironment;
exports.TestEnvironment = TestEnvironment;
exports["default"] = JSDOMEnvironment;
const TestEnvironment = exports.TestEnvironment = JSDOMEnvironment;
})();
module.exports = __webpack_exports__;
/******/ })()
;
{
"name": "jest-environment-jsdom",
"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,13 +23,13 @@ },

"dependencies": {
"@jest/environment": "^29.7.0",
"@jest/fake-timers": "^29.7.0",
"@jest/types": "^29.6.3",
"@types/jsdom": "^20.0.0",
"@jest/environment": "30.0.0-alpha.1",
"@jest/fake-timers": "30.0.0-alpha.1",
"@jest/types": "30.0.0-alpha.1",
"@types/jsdom": "^21.1.1",
"@types/node": "*",
"jest-mock": "^29.7.0",
"jest-util": "^29.7.0",
"jsdom": "^20.0.0"
"jest-mock": "30.0.0-alpha.1",
"jest-util": "30.0.0-alpha.1",
"jsdom": "^22.0.0"
},
"devDependencies": {
"@jest/test-utils": "^29.7.0"
"@jest/test-utils": "30.0.0-alpha.1"
},

@@ -43,3 +45,3 @@ "peerDependencies": {

"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
"node": "^16.10.0 || ^18.12.0 || >=20.0.0"
},

@@ -49,3 +51,3 @@ "publishConfig": {

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