Skip to main content

@luma.gl/core/test-utils

Import test devices and resource helpers from @luma.gl/core/test-utils. This optional entry registers the WebGL and WebGPU adapters without importing engine or graph, or creating a device eagerly. It is intended for tests, and is not exported by the core package root.

import {getWebGPUTestDevice, NullDevice} from '@luma.gl/core/test-utils';

const device = await getWebGPUTestDevice();
if (device) {
// Encode, submit, and read back GPU work using the normal Device API.
}

const nullDevice = new NullDevice({});
// Use the null backend for CPU-side validation without a browser GPU.
nullDevice.destroy();

Exports​

  • getTestDevices, getTestDevice, getWebGLTestDevice, getPresentationWebGLTestDevice, getWebGPUTestDevice, getWebGPUTestDevices, and getNullTestDevice provide cached test devices.
  • NullDevice, NullAdapter, and nullAdapter provide the null backend.
  • checkType, deepCopy, getResourceCounts, and getLeakedResources support test assertions.

Use Vitest and the repository Playwright utilities for browser execution and image comparisons. See Testing and browser automation.