test: add vitest-canvas-mock for local canvas support

Fixes UILayer tests failing locally due to the native canvas package
not being compiled. vitest-canvas-mock provides a jsdom-compatible
Canvas 2D API mock without requiring native build tools.
This commit is contained in:
evanpelle
2026-02-24 15:59:14 -06:00
parent 339ace0bd6
commit 9b96b07820
3 changed files with 36 additions and 2 deletions
+33 -1
View File
@@ -100,7 +100,8 @@
"vite-plugin-html": "^3.2.2",
"vite-plugin-static-copy": "^3.1.4",
"vite-tsconfig-paths": "^6.0.3",
"vitest": "^4.0.16"
"vitest": "^4.0.16",
"vitest-canvas-mock": "^1.1.3"
}
},
"node_modules/@acemir/cssom": {
@@ -6361,6 +6362,13 @@
"url": "https://github.com/sponsors/fb55"
}
},
"node_modules/cssfontparser": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/cssfontparser/-/cssfontparser-1.2.1.tgz",
"integrity": "sha512-6tun4LoZnj7VN6YeegOVb67KBX/7JJsqvj+pv3ZA7F878/eN33AbGa5b/S/wXxS/tcp8nc40xRUrsPlxIyNUPg==",
"dev": true,
"license": "MIT"
},
"node_modules/cssstyle": {
"version": "5.3.5",
"resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-5.3.5.tgz",
@@ -9708,6 +9716,16 @@
"dev": true,
"license": "MIT"
},
"node_modules/moo-color": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/moo-color/-/moo-color-1.0.3.tgz",
"integrity": "sha512-i/+ZKXMDf6aqYtBhuOcej71YSlbjT3wCO/4H1j8rPvxDJEifdwgg5MaFyu6iYAT8GBZJg2z0dkgK4YMzvURALQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"color-name": "^1.1.4"
}
},
"node_modules/mrmime": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz",
@@ -12891,6 +12909,20 @@
}
}
},
"node_modules/vitest-canvas-mock": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/vitest-canvas-mock/-/vitest-canvas-mock-1.1.3.tgz",
"integrity": "sha512-zlKJR776Qgd+bcACPh0Pq5MG3xWq+CdkACKY/wX4Jyija0BSz8LH3aCCgwFKYFwtm565+050YFEGG9Ki0gE/Hw==",
"dev": true,
"license": "MIT",
"dependencies": {
"cssfontparser": "^1.2.1",
"moo-color": "^1.0.3"
},
"peerDependencies": {
"vitest": "^3.0.0 || ^4.0.0"
}
},
"node_modules/vitest/node_modules/pathe": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
+2 -1
View File
@@ -85,7 +85,8 @@
"vite-plugin-html": "^3.2.2",
"vite-plugin-static-copy": "^3.1.4",
"vite-tsconfig-paths": "^6.0.3",
"vitest": "^4.0.16"
"vitest": "^4.0.16",
"vitest-canvas-mock": "^1.1.3"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.758.0",
+1
View File
@@ -1 +1,2 @@
// Add global mocks or configuration here if needed
import "vitest-canvas-mock";