jest-environment-node
Advanced tools
Comparing version 28.0.0-alpha.4 to 28.0.0-alpha.5
@@ -9,6 +9,7 @@ /** | ||
import type {Config} from '@jest/types'; | ||
import {Context} from 'vm'; | ||
import type {EnvironmentContext} from '@jest/environment'; | ||
import type {Global} from '@jest/types'; | ||
import type {JestEnvironment} from '@jest/environment'; | ||
import type {JestEnvironmentConfig} from '@jest/environment'; | ||
import {LegacyFakeTimers} from '@jest/fake-timers'; | ||
@@ -24,3 +25,3 @@ import {ModernFakeTimers} from '@jest/fake-timers'; | ||
moduleMocker: ModuleMocker | null; | ||
constructor(config: Config.ProjectConfig); | ||
constructor(config: JestEnvironmentConfig, _context: EnvironmentContext); | ||
setup(): Promise<void>; | ||
@@ -27,0 +28,0 @@ teardown(): Promise<void>; |
@@ -59,9 +59,10 @@ 'use strict'; | ||
global; | ||
moduleMocker; | ||
moduleMocker; // while `context` is unused, it should always be passed | ||
constructor(config) { | ||
constructor(config, _context) { | ||
const {projectConfig} = config; | ||
this.context = (0, _vm().createContext)(); | ||
const global = (this.global = (0, _vm().runInContext)( | ||
'this', | ||
Object.assign(this.context, config.testEnvironmentOptions) | ||
Object.assign(this.context, projectConfig.testEnvironmentOptions) | ||
)); | ||
@@ -115,3 +116,3 @@ global.global = global; | ||
(0, _jestUtil().installCommonGlobals)(global, config.globals); | ||
(0, _jestUtil().installCommonGlobals)(global, projectConfig.globals); | ||
this.moduleMocker = new (_jestMock().ModuleMocker)(global); | ||
@@ -138,3 +139,3 @@ | ||
this.fakeTimers = new (_fakeTimers().LegacyFakeTimers)({ | ||
config, | ||
config: projectConfig, | ||
global, | ||
@@ -145,3 +146,3 @@ moduleMocker: this.moduleMocker, | ||
this.fakeTimersModern = new (_fakeTimers().ModernFakeTimers)({ | ||
config, | ||
config: projectConfig, | ||
global | ||
@@ -148,0 +149,0 @@ }); |
{ | ||
"name": "jest-environment-node", | ||
"version": "28.0.0-alpha.4", | ||
"version": "28.0.0-alpha.5", | ||
"repository": { | ||
@@ -20,11 +20,11 @@ "type": "git", | ||
"dependencies": { | ||
"@jest/environment": "^28.0.0-alpha.4", | ||
"@jest/fake-timers": "^28.0.0-alpha.4", | ||
"@jest/types": "^28.0.0-alpha.4", | ||
"@jest/environment": "^28.0.0-alpha.5", | ||
"@jest/fake-timers": "^28.0.0-alpha.5", | ||
"@jest/types": "^28.0.0-alpha.5", | ||
"@types/node": "*", | ||
"jest-mock": "^28.0.0-alpha.4", | ||
"jest-util": "^28.0.0-alpha.4" | ||
"jest-mock": "^28.0.0-alpha.5", | ||
"jest-util": "^28.0.0-alpha.5" | ||
}, | ||
"devDependencies": { | ||
"@jest/test-utils": "^28.0.0-alpha.4" | ||
"@jest/test-utils": "^28.0.0-alpha.5" | ||
}, | ||
@@ -37,3 +37,3 @@ "engines": { | ||
}, | ||
"gitHead": "c13dab19491ba6b57c2d703e7d7c4b20189e1e17" | ||
"gitHead": "46fb19b2628bd87676c10730ba19592c30b05478" | ||
} |
7572
172