Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@luma.gl/test-utils

Package Overview
Dependencies
Maintainers
7
Versions
246
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@luma.gl/test-utils - npm Package Compare versions

Comparing version 9.0.0-beta.5 to 9.0.0-beta.6

8

dist/create-test-device.js

@@ -1,2 +0,3 @@

// luma.gl, MIT license
// luma.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors

@@ -44,3 +45,6 @@ import { luma } from '@luma.gl/core';

try {
webgpuDevice = await luma.createDevice({ id: 'webgpu-test-device', type: 'webgpu' });
webgpuDevice = (await luma.createDevice({
id: 'webgpu-test-device',
type: 'webgpu'
}));
}

@@ -47,0 +51,0 @@ catch {

@@ -0,1 +1,4 @@

// luma.gl
// SPDX-License
// Copyright (c) vis.gl contributors
// TODO - replace createGLContext, instrumentGLContext, resizeGLContext?

@@ -20,3 +23,3 @@ // TODO - remove dependency on framebuffer (bundle size impact)

onFinalize: () => { },
onError: (error) => console.error(error), // eslint-disable-line no-console
onError: error => console.error(error), // eslint-disable-line no-console
device: null,

@@ -204,3 +207,3 @@ // debug: true,

if (!this._nextFramePromise) {
this._nextFramePromise = new Promise((resolve) => {
this._nextFramePromise = new Promise(resolve => {
this._resolveNextFrame = resolve;

@@ -207,0 +210,0 @@ });

@@ -1,12 +0,12 @@

import './register-devices';
export type { TestRunnerTestCase } from './test-runner';
export type { SnapshotTestRunnerTestCase } from './snapshot-test-runner';
export { SnapshotTestRunner } from './snapshot-test-runner';
export { PerformanceTestRunner } from './performance-test-runner';
export { webglDevice, webgpuDevice } from './create-test-device';
export { getTestDevices, getWebGLTestDevices } from './create-test-device';
export { createTestDevice, createTestContext } from './create-test-device';
export { checkType } from './utils/check-type';
export { deepCopy } from './utils/deep-copy';
export { getResourceCounts, getLeakedResources } from './utils/resource-tracker';
import "./register-devices.js";
export type { TestRunnerTestCase } from "./test-runner.js";
export type { SnapshotTestRunnerTestCase } from "./snapshot-test-runner.js";
export { SnapshotTestRunner } from "./snapshot-test-runner.js";
export { PerformanceTestRunner } from "./performance-test-runner.js";
export { webglDevice, webgpuDevice } from "./create-test-device.js";
export { getTestDevices, getWebGLTestDevices } from "./create-test-device.js";
export { createTestDevice, createTestContext } from "./create-test-device.js";
export { checkType } from "./utils/check-type.js";
export { deepCopy } from "./utils/deep-copy.js";
export { getResourceCounts, getLeakedResources } from "./utils/resource-tracker.js";
//# sourceMappingURL=index.d.ts.map

@@ -1,11 +0,11 @@

import './register-devices';
export { SnapshotTestRunner } from './snapshot-test-runner';
export { PerformanceTestRunner } from './performance-test-runner';
import "./register-devices.js";
export { SnapshotTestRunner } from "./snapshot-test-runner.js";
export { PerformanceTestRunner } from "./performance-test-runner.js";
// TEST DEVICES
export { webglDevice, webgpuDevice } from './create-test-device';
export { getTestDevices, getWebGLTestDevices } from './create-test-device';
export { createTestDevice, createTestContext } from './create-test-device';
export { webglDevice, webgpuDevice } from "./create-test-device.js";
export { getTestDevices, getWebGLTestDevices } from "./create-test-device.js";
export { createTestDevice, createTestContext } from "./create-test-device.js";
// UTILS
export { checkType } from './utils/check-type';
export { deepCopy } from './utils/deep-copy';
export { getResourceCounts, getLeakedResources } from './utils/resource-tracker';
export { checkType } from "./utils/check-type.js";
export { deepCopy } from "./utils/deep-copy.js";
export { getResourceCounts, getLeakedResources } from "./utils/resource-tracker.js";

@@ -1,2 +0,2 @@

import { TestRunner, TestRunnerProps, TestRunnerTestCase } from './test-runner';
import { TestRunner, TestRunnerProps, TestRunnerTestCase } from "./test-runner.js";
export type PerformanceTestRunnerProps = TestRunnerProps;

@@ -3,0 +3,0 @@ export declare class PerformanceTestRunner extends TestRunner {

@@ -1,5 +0,6 @@

// luma.gl, MIT license
// luma.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
import { Stats } from '@probe.gl/stats';
import { TestRunner } from './test-runner';
import { TestRunner } from "./test-runner.js";
export class PerformanceTestRunner extends TestRunner {

@@ -6,0 +7,0 @@ _stats = null;

@@ -1,2 +0,3 @@

// luma.gl, MIT license
// luma.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors

@@ -3,0 +4,0 @@ import { luma } from '@luma.gl/core';

@@ -1,2 +0,2 @@

import { TestRunner, TestRunnerProps, TestRunnerTestCase } from './test-runner';
import { TestRunner, TestRunnerProps, TestRunnerTestCase } from "./test-runner.js";
/** A snapshot test case */

@@ -3,0 +3,0 @@ export type SnapshotTestRunnerTestCase = TestRunnerTestCase & {

@@ -1,3 +0,6 @@

import { TestRunner } from './test-runner';
import { getBoundingBoxInPage } from './utils/get-bounding-box';
// luma.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
import { TestRunner } from "./test-runner.js";
import { getBoundingBoxInPage } from "./utils/get-bounding-box.js";
export class SnapshotTestRunner extends TestRunner {

@@ -4,0 +7,0 @@ // should be defined here but hack access in TestRunner

import { AnimationProps } from '@luma.gl/engine';
import { ClassicAnimationLoop as AnimationLoop } from './engine/classic-animation-loop';
import { ClassicAnimationLoop as AnimationLoop } from "./engine/classic-animation-loop.js";
/** Describes a test case */

@@ -54,4 +54,4 @@ export type TestRunnerTestCase = {

/**
* Returns a promise that resolves when all the test cases are done
*/
* Returns a promise that resolves when all the test cases are done
*/
run(options?: object): Promise<void>;

@@ -58,0 +58,0 @@ initTestCase(testCase: TestRunnerTestCase): void;

@@ -1,6 +0,7 @@

// @ts-nocheck
/* eslint-disable */
import { webglDevice } from './create-test-device';
// luma.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
import { webglDevice } from "./create-test-device.js";
// TODO - Replace with new AnimationLoop from `@luma.gl/engine`
import { ClassicAnimationLoop as AnimationLoop } from './engine/classic-animation-loop';
import { ClassicAnimationLoop as AnimationLoop } from "./engine/classic-animation-loop.js";
const DEFAULT_TEST_CASE = {

@@ -61,4 +62,4 @@ name: 'Unnamed test',

/**
* Returns a promise that resolves when all the test cases are done
*/
* Returns a promise that resolves when all the test cases are done
*/
run(options = {}) {

@@ -192,3 +193,3 @@ this.testOptions = { ...this.testOptions, ...options };

// onInitialized could return a plain object or a promise
Promise.resolve(testCase.onInitialize(initProps)).then((userData) => {
Promise.resolve(testCase.onInitialize(initProps)).then(userData => {
this._testCaseData = userData || {};

@@ -195,0 +196,0 @@ });

/** Recursively copies objects */
export function deepCopy(object) {
if (Array.isArray(object)) {
return object.map((element) => deepCopy(element));
return object.map(element => deepCopy(element));
}

@@ -6,0 +6,0 @@ if (object !== null && typeof object === 'object') {

{
"name": "@luma.gl/test-utils",
"version": "9.0.0-beta.5",
"version": "9.0.0-beta.6",
"description": "Automated WebGL testing utilities with Puppeteer and image diffing",

@@ -46,6 +46,6 @@ "type": "module",

"devDependencies": {
"@luma.gl/core": "9.0.0-beta.5",
"@luma.gl/engine": "9.0.0-beta.5",
"@luma.gl/webgl": "9.0.0-beta.5",
"@luma.gl/webgpu": "9.0.0-beta.5"
"@luma.gl/core": "9.0.0-beta.6",
"@luma.gl/engine": "9.0.0-beta.6",
"@luma.gl/webgl": "9.0.0-beta.6",
"@luma.gl/webgpu": "9.0.0-beta.6"
},

@@ -55,3 +55,3 @@ "dependencies": {

},
"gitHead": "793d3ab42f5a572b6cb603ea78aabaa73a873301"
"gitHead": "cb2f0938d03a65e3588622ac99650b14a10488b6"
}

@@ -1,2 +0,3 @@

// luma.gl, MIT license
// luma.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors

@@ -35,3 +36,3 @@

/** A WebGL 2 Device intended for testing */
export const webglDevice: WebGLDevice = createTestDevice({id: 'webgl2-test-device'}) ;
export const webglDevice: WebGLDevice = createTestDevice({id: 'webgl2-test-device'});

@@ -51,7 +52,10 @@ /** Only available after getTestDevices() has completed */

/** Includes WebGPU device if available */
export async function getTestDevices() : Promise<Device[]> {
export async function getTestDevices(): Promise<Device[]> {
if (!webgpuCreated) {
webgpuCreated = true;
try {
webgpuDevice = await luma.createDevice({id: 'webgpu-test-device', type: 'webgpu'}) as WebGPUDevice;
webgpuDevice = (await luma.createDevice({
id: 'webgpu-test-device',
type: 'webgpu'
})) as WebGPUDevice;
} catch {

@@ -58,0 +62,0 @@ // ignore (assume WebGPU was not available)

@@ -0,1 +1,5 @@

// luma.gl
// SPDX-License
// Copyright (c) vis.gl contributors
// TODO - replace createGLContext, instrumentGLContext, resizeGLContext?

@@ -90,3 +94,3 @@ // TODO - remove dependency on framebuffer (bundle size impact)

onFinalize: () => {},
onError: (error) => console.error(error), // eslint-disable-line no-console
onError: error => console.error(error), // eslint-disable-line no-console

@@ -317,3 +321,3 @@ device: null,

if (!this._nextFramePromise) {
this._nextFramePromise = new Promise((resolve) => {
this._nextFramePromise = new Promise(resolve => {
this._resolveNextFrame = resolve;

@@ -393,10 +397,10 @@ });

? new Promise((resolve, reject) => {
if (isPage && document.readyState === 'complete') {
resolve(document);
return;
}
window.addEventListener('load', () => {
resolve(document);
});
})
if (isPage && document.readyState === 'complete') {
resolve(document);
return;
}
window.addEventListener('load', () => {
resolve(document);
});
})
: Promise.resolve({});

@@ -588,3 +592,3 @@ }

_createInfoDiv() {
const canvas = getHTMLCanvasElement(this.gl.canvas)
const canvas = getHTMLCanvasElement(this.gl.canvas);
if (canvas && this.props.onAddHTML) {

@@ -591,0 +595,0 @@ const wrapperDiv = document.createElement('div');

@@ -1,2 +0,3 @@

// luma.gl, MIT license
// luma.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors

@@ -3,0 +4,0 @@

@@ -1,2 +0,3 @@

// luma.gl, MIT license
// luma.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors

@@ -3,0 +4,0 @@

@@ -0,1 +1,5 @@

// luma.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
import {TestRunner, TestRunnerProps, TestRunnerTestCase} from './test-runner';

@@ -9,4 +13,4 @@ import {getBoundingBoxInPage} from './utils/get-bounding-box';

/** Diff options */
imageDiffOptions?: {[key: string]: any};
}
imageDiffOptions?: {[key: string]: any};
};

@@ -13,0 +17,0 @@ export type SnapshotTestRunnerProps = TestRunnerProps;

@@ -0,1 +1,5 @@

// luma.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
// @ts-nocheck

@@ -51,4 +55,6 @@ /* eslint-disable */

onTestStart: (testCase: TestRunnerTestCase) => console.log(`# ${testCase.name}`),
onTestPass: (testCase: TestRunnerTestCase, result?: unknown) => console.log(`ok ${testCase.name} passed`),
onTestFail: (testCase: TestRunnerTestCase, error?: unknown) => console.log(`not ok ${testCase.name} failed`),
onTestPass: (testCase: TestRunnerTestCase, result?: unknown) =>
console.log(`ok ${testCase.name} passed`),
onTestFail: (testCase: TestRunnerTestCase, error?: unknown) =>
console.log(`not ok ${testCase.name} failed`),

@@ -103,5 +109,5 @@ // milliseconds to wait for each test case before aborting

/**
* Returns a promise that resolves when all the test cases are done
*/
run(options: object = {}): Promise<void> {
* Returns a promise that resolves when all the test cases are done
*/
run(options: object = {}): Promise<void> {
this.testOptions = {...this.testOptions, ...options};

@@ -124,3 +130,3 @@

this._currentTestCase = null;
}).catch (error => {
}).catch(error => {
this._fail({error: error.message});

@@ -184,3 +190,3 @@ // reject(error);

const testCaseAnimationProps: AnimationProps = {
...animationProps,
...animationProps,
...this._testCaseData,

@@ -262,3 +268,3 @@ // tick/time starts from 0 for each test case

// onInitialized could return a plain object or a promise
Promise.resolve(testCase.onInitialize(initProps)).then((userData) => {
Promise.resolve(testCase.onInitialize(initProps)).then(userData => {
this._testCaseData = userData || {};

@@ -265,0 +271,0 @@ });

@@ -1,2 +0,1 @@

/**

@@ -3,0 +2,0 @@ * Tests that an argument matches the type.

/** Recursively copies objects */
export function deepCopy(object: Record<string, any>) {
if (Array.isArray(object)) {
return object.map((element) => deepCopy(element));
return object.map(element => deepCopy(element));
}

@@ -6,0 +6,0 @@

// Get the bounding box of a DOMElement relative to the page
export function getBoundingBoxInPage(domElement: HTMLElement): {x: number; y: number; width: number; height: number;} {
export function getBoundingBoxInPage(domElement: HTMLElement): {
x: number;
y: number;
width: number;
height: number;
} {
const bbox = domElement.getBoundingClientRect();

@@ -4,0 +9,0 @@ return {

@@ -11,3 +11,6 @@ /* global luma */

export function getLeakedResources(startCounts: Record<string, number>, endCounts: Record<string, number>): number | null {
export function getLeakedResources(
startCounts: Record<string, number>,
endCounts: Record<string, number>
): number | null {
let leakedResources = null;

@@ -14,0 +17,0 @@ const info = 'leaking: ';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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