• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

visgl / luma.gl / 23357510199

20 Mar 2026 06:40PM UTC coverage: 58.158% (+5.9%) from 52.213%
23357510199

push

github

web-flow
chore: Run tests on src instead of dist (#2555)

3021 of 6029 branches covered (50.11%)

Branch coverage included in aggregate %.

7102 of 11377 relevant lines covered (62.42%)

243.33 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

65.0
/modules/test-utils/src/deprecated/sync-test-device.ts
1
// luma.gl
2
// SPDX-License
3
// Copyright (c) vis.gl contributors
4

5
import type {CanvasContextProps} from '@luma.gl/core';
6
import {WebGLDevice} from '@luma.gl/webgl';
7

8
const DEFAULT_CANVAS_CONTEXT_PROPS: CanvasContextProps = {
55✔
9
  width: 1,
10
  height: 1
11
};
12

13
/**
14
 * Create a test WebGLDevice
15
 * @note This WebGL Device is create synchronously and can be used directly but will not have WebGL debugging initialized
16
 * @deprecated Use getWebGLTestDevice().
17
 */
18
export function createTestDevice(): WebGLDevice | null {
19
  if (cachedWebglDevice) {
55!
20
    return cachedWebglDevice;
×
21
  }
22

23
  if (
55!
24
    typeof navigator === 'undefined' ||
165✔
25
    typeof document === 'undefined' ||
26
    typeof HTMLCanvasElement === 'undefined'
27
  ) {
28
    return null;
×
29
  }
30

31
  try {
55✔
32
    // TODO - We do not use luma.createDevice since createTestDevice currently expect WebGL context to be created synchronously
33
    cachedWebglDevice = new WebGLDevice({createCanvasContext: DEFAULT_CANVAS_CONTEXT_PROPS});
55✔
34
    return cachedWebglDevice;
55✔
35
  } catch (error) {
36
    // eslint-disable-next-line no-console
37
    console.error(`Failed to created device: ${(error as Error).message}`);
×
38
    debugger; // eslint-disable-line no-debugger
×
39
    return null;
×
40
  }
41
}
42

43
/**
44
 * A pre-created WebGLDevice
45
 * @note This WebGL Device is create synchronously and can be used directly but will not have WebGL debugging initialized
46
 * @deprecated Use getWebGLTestDevice().
47
 */
48
let cachedWebglDevice: WebGLDevice | null = null;
55✔
49

50
export const webglDevice = createTestDevice();
55✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc