Closed ad1992 closed 1 month ago
On further debugging, this is where its thrown from in jest-canvas-mock
in prototype.js
. The win
object doesn't have HTMLCanvasElement
hence the error
There is an issue for the same opened in jest-canvas-mock
On further debugging, this is where its thrown from in
jest-canvas-mock
inprototype.js
. Thewin
object doesn't haveHTMLCanvasElement
hence the error
Hi @ad1992 ,
Would you have a gist with the exact steps you followed? Seems you've patched the code in jest-canvas-mock, then use selective version resolutions?
For those who need it:
With Yarn, in your package.json
"resolutions": {
"vitest-canvas-mock/jest-canvas-mock": "2.4.0"
}
Thanks @ad1992
I have the same problem
I tried the solution above by @jenaicprb , but I use npm so my alternative to yarn's "resolution" was this:
"overrides": { "vitest-canvas-mock": { "jest-canvas-mock": "2.4.0" } }
but I still get the same error
Latest version uses jest-canvas-mock@2.4.0
, still getting the error?
Yes the patch version of Vite works well and resolutions
field isn't needed anymore, Thanks @wobsoriano
Also the issue seems to be fixed in jest-canvas-mock@2.5.2
reference - https://github.com/hustcc/jest-canvas-mock/pull/116 , can you release a patch version for vitest-canvas-mock ?
@ad1992 updated to use jest-canvas-mock@2.5.2
! Let me know if that still works.
@ad1992 updated to use
jest-canvas-mock@2.5.2
! Let me know if that still works.
A little late here, but yes everything works well so I am closing this.
Thanks @wobsoriano ✨
Hi @wobsoriano thanks for this package!
I am trying to migrate CRA to Vite in Excalidraw and running into issues when migrating tests. We are using
jest-canvas-mock
and thats how I came across this library when migrating to Vite. However I am getting 👇🏻 errorIn addition when I disable the
threads
as suggested in theReadme
, the tests just hangs and I have to manually terminate.Could you tell me how can I fix it ?