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 27.5.1 to 28.0.0-alpha.0

50

build/index.d.ts

@@ -8,23 +8,33 @@ /**

/// <reference types="node" />
import { Context } from 'vm';
import type { JestEnvironment } from '@jest/environment';
import { LegacyFakeTimers, ModernFakeTimers } from '@jest/fake-timers';
import type { Config, Global } from '@jest/types';
import { ModuleMocker } from 'jest-mock';
import type {Config} from '@jest/types';
import {Context} from 'vm';
import type {Global} from '@jest/types';
import type {JestEnvironment} from '@jest/environment';
import {LegacyFakeTimers} from '@jest/fake-timers';
import {ModernFakeTimers} from '@jest/fake-timers';
import {ModuleMocker} from 'jest-mock';
declare class NodeEnvironment implements JestEnvironment<Timer> {
context: Context | null;
fakeTimers: LegacyFakeTimers<Timer> | null;
fakeTimersModern: ModernFakeTimers | null;
global: Global.Global;
moduleMocker: ModuleMocker | null;
constructor(config: Config.ProjectConfig);
setup(): Promise<void>;
teardown(): Promise<void>;
exportConditions(): Array<string>;
getVmContext(): Context | null;
}
export default NodeEnvironment;
export declare const TestEnvironment: typeof NodeEnvironment;
declare type Timer = {
id: number;
ref: () => Timer;
unref: () => Timer;
id: number;
ref: () => Timer;
unref: () => Timer;
};
declare class NodeEnvironment implements JestEnvironment<Timer> {
context: Context | null;
fakeTimers: LegacyFakeTimers<Timer> | null;
fakeTimersModern: ModernFakeTimers | null;
global: Global.Global;
moduleMocker: ModuleMocker | null;
constructor(config: Config.ProjectConfig);
setup(): Promise<void>;
teardown(): Promise<void>;
getVmContext(): Context | null;
}
export = NodeEnvironment;
export {};

68

build/index.js
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = exports.TestEnvironment = void 0;
function _vm() {

@@ -43,28 +48,16 @@ const data = require('vm');

function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
class NodeEnvironment {
context;
fakeTimers;
fakeTimersModern;
global;
moduleMocker;
class NodeEnvironment {
constructor(config) {
_defineProperty(this, 'context', void 0);
_defineProperty(this, 'fakeTimers', void 0);
_defineProperty(this, 'fakeTimersModern', void 0);
_defineProperty(this, 'global', void 0);
_defineProperty(this, 'moduleMocker', void 0);
this.context = (0, _vm().createContext)();

@@ -89,18 +82,9 @@ const global = (this.global = (0, _vm().runInContext)(

if (typeof URL !== 'undefined' && typeof URLSearchParams !== 'undefined') {
global.URL = URL;
global.URLSearchParams = URLSearchParams;
} // TextDecoder and TextDecoder are global in Node >= 11
global.URL = URL;
global.URLSearchParams = URLSearchParams; // TextDecoder and TextDecoder are global in Node >= 11
if (
typeof TextEncoder !== 'undefined' &&
typeof TextDecoder !== 'undefined'
) {
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;
} // queueMicrotask is global in Node >= 11
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder; // queueMicrotask is global in Node >= 11
if (typeof queueMicrotask !== 'undefined') {
global.queueMicrotask = queueMicrotask;
} // AbortController is global in Node >= 15
global.queueMicrotask = queueMicrotask; // AbortController is global in Node >= 15

@@ -181,2 +165,6 @@ if (typeof AbortController !== 'undefined') {

exportConditions() {
return ['node', 'node-addons'];
}
getVmContext() {

@@ -187,2 +175,4 @@ return this.context;

module.exports = NodeEnvironment;
exports.default = NodeEnvironment;
const TestEnvironment = NodeEnvironment;
exports.TestEnvironment = TestEnvironment;
{
"name": "jest-environment-node",
"version": "27.5.1",
"version": "28.0.0-alpha.0",
"repository": {

@@ -20,14 +20,14 @@ "type": "git",

"dependencies": {
"@jest/environment": "^27.5.1",
"@jest/fake-timers": "^27.5.1",
"@jest/types": "^27.5.1",
"@jest/environment": "^28.0.0-alpha.0",
"@jest/fake-timers": "^28.0.0-alpha.0",
"@jest/types": "^28.0.0-alpha.0",
"@types/node": "*",
"jest-mock": "^27.5.1",
"jest-util": "^27.5.1"
"jest-mock": "^28.0.0-alpha.0",
"jest-util": "^28.0.0-alpha.0"
},
"devDependencies": {
"@jest/test-utils": "^27.5.1"
"@jest/test-utils": "^28.0.0-alpha.0"
},
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
},

@@ -37,3 +37,3 @@ "publishConfig": {

},
"gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850"
"gitHead": "89275b08977065d98e42ad71fcf223f4ad169f09"
}
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