From a0aeb101cd29260ebf511c8bac534ab66a070454 Mon Sep 17 00:00:00 2001 From: David Montero Crespo Date: Tue, 18 Aug 2026 02:05:01 +0200 Subject: [PATCH] test: declare `canvas` so the jsdom tests get a real 2D context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit captureDisplay.test.ts runs under @vitest-environment jsdom and says in its own header that "jsdom + the `canvas` package give a real 2D context here" — but canvas was never a direct devDependency. jsdom lists it as optional, so npm skipped it, getContext('2d') returned null, and five tests died on `ctx.fillStyle` with a TypeError. That aborted the pre-deploy test gate. Declaring it directly makes the install deterministic; the lockfile already carried the entry. All six tests pass with it present. --- frontend/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/package.json b/frontend/package.json index bfd2c1be..49d77e27 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -69,6 +69,7 @@ "@vitejs/plugin-react": "^5.1.1", "@vitest/coverage-v8": "^4.0.18", "@vitest/ui": "^4.0.18", + "canvas": "^3.2.3", "eslint": "^9.39.1", "eslint-config-prettier": "10.1.8", "eslint-plugin-react-hooks": "^7.0.1",