fix(image-pipeline): apply wasm/webgl lint hygiene cleanups

This commit is contained in:
Matthias
2026-04-04 23:06:43 +02:00
parent d10cb7ac8f
commit 86f487d0ef
3 changed files with 13 additions and 10 deletions

View File

@@ -25,8 +25,8 @@ function assertWasmSimdRuntimeSupport(): void {
throw new Error("WebAssembly SIMD is unavailable.");
}
const module = new WebAssembly.Module(WASM_SIMD_PROBE_MODULE);
void new WebAssembly.Instance(module);
const wasmModule = new WebAssembly.Module(WASM_SIMD_PROBE_MODULE);
void new WebAssembly.Instance(wasmModule);
}
export function loadWasmKernelModule(): WasmKernelModule {

View File

@@ -326,13 +326,13 @@ describe("wasm backend fallback behavior", () => {
vi.stubGlobal("SharedArrayBuffer", undefined);
vi.stubGlobal("Worker", undefined);
const module: WasmKernelModule = {
const wasmModule: WasmKernelModule = {
applyPreviewStep: vi.fn(),
applyFullPipeline: vi.fn(),
};
const backend = createWasmSimdBackend({
loadModule: () => module,
loadModule: () => wasmModule,
});
expect(() => {
@@ -343,6 +343,6 @@ describe("wasm backend fallback behavior", () => {
height: 1,
});
}).not.toThrow();
expect(module.applyPreviewStep).toHaveBeenCalledTimes(1);
expect(wasmModule.applyPreviewStep).toHaveBeenCalledTimes(1);
});
});

View File

@@ -380,8 +380,9 @@ describe("webgl backend poc", () => {
height: 1,
});
const sourceTexture = (fakeGl.createTexture as any).mock.results[0]?.value;
const outputTexture = (fakeGl.createTexture as any).mock.results[1]?.value;
const createTextureMock = vi.mocked(fakeGl.createTexture);
const sourceTexture = createTextureMock.mock.results[0]?.value;
const outputTexture = createTextureMock.mock.results[1]?.value;
expect(sourceTexture).toBeTruthy();
expect(outputTexture).toBeTruthy();
@@ -393,9 +394,11 @@ describe("webgl backend poc", () => {
0,
);
const bindTextureCalls = (fakeGl.bindTexture as any).mock.calls as Array<[number, unknown]>;
const bindTextureOrder = (fakeGl.bindTexture as any).mock.invocationCallOrder as number[];
const drawOrder = (fakeGl.drawArrays as any).mock.invocationCallOrder[0] as number;
const bindTextureMock = vi.mocked(fakeGl.bindTexture);
const drawArraysMock = vi.mocked(fakeGl.drawArrays);
const bindTextureCalls = bindTextureMock.mock.calls;
const bindTextureOrder = bindTextureMock.mock.invocationCallOrder;
const drawOrder = drawArraysMock.mock.invocationCallOrder[0] ?? Number.POSITIVE_INFINITY;
const lastBindBeforeDrawIndex = bindTextureOrder
.map((callOrder, index) => ({ callOrder, index }))
.filter(({ callOrder, index }) => callOrder < drawOrder && bindTextureCalls[index]?.[0] === fakeGl.TEXTURE_2D)