Skip to main content

jest-environment-webgl-node

Classes​

default​

Jest environment that puts real headless WebGL 1 and 2 (ANGLE via @onirenaud/node-webgl) and a browser-like DOM on the sandbox global. Each test file gets a fresh document and animation-frame queue. Set options under testEnvironmentOptions; see WebglNodeOptions.

Extends​

  • TestEnvironment

Constructors​

Constructor​
new default(config, context): default;

Creates the environment and installs the DOM; Jest calls this once per test file.

Parameters​
ParameterTypeDescription
configJestEnvironmentConfigJest's environment config; the WebGL options are read from testEnvironmentOptions.
contextEnvironmentContextJest's environment context.
Returns​

default

Overrides​

TestEnvironment.constructor

Properties​

context​
context: Context | null;
Inherited from​

TestEnvironment.context

customExportConditions​
customExportConditions: string[];
Inherited from​

TestEnvironment.customExportConditions

fakeTimers​
fakeTimers: LegacyFakeTimers<Timer> | null;
Inherited from​

TestEnvironment.fakeTimers

fakeTimersModern​
fakeTimersModern: ModernFakeTimers | null;
Inherited from​

TestEnvironment.fakeTimersModern

global​
global: Global_3;
Inherited from​

TestEnvironment.global

moduleMocker​
moduleMocker: ModuleMocker | null;
Inherited from​

TestEnvironment.moduleMocker

Methods​

exportConditions()​
exportConditions(): string[];
Returns​

string[]

Inherited from​

TestEnvironment.exportConditions

getVmContext()​
getVmContext(): Context | null;
Returns​

Context | null

Inherited from​

TestEnvironment.getVmContext

setup()​
setup(): Promise<void>;
Returns​

Promise<void>

Inherited from​

TestEnvironment.setup

teardown()​
teardown(): Promise<void>;

Cancels pending animation frames, disposes canvases the environment created and removes the installed globals.

Returns​

Promise<void>

Overrides​

TestEnvironment.teardown

Type Aliases​

WebglNodeOptions​

type WebglNodeOptions = InitOptions & InstallDOMOptions;

Set under testEnvironmentOptions in your Jest config.