You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, we are trying to replace the canvas npm dependency with just your mock to speedup our ci infrastructure.
I've replaced the library and I'm getting the following error:
'CanvasRenderingContext2D': parameter 1 is not of type 'Path2D'
when something like this exists in my code:
ctx.stroke(new Path2D(line));
The problem seems caused by the fact that Path2D is available in my jest environment when running the test (Path2D doesn't probably need any special os-dependent treatment and is available in the jsdom) and you, correctly, don't mock if it is present:
@jtenner a similar issue happens also with the DOMMatrix as described here #85
The canvas context getTransform returns a DOMMatrix that is an instance of the internal implementation, not the one coming from the environment if present on window.
Hi, we are trying to replace the
canvas
npm dependency with just your mock to speedup our ci infrastructure.I've replaced the library and I'm getting the following error:
when something like this exists in my code:
The problem seems caused by the fact that Path2D is available in my jest environment when running the test (Path2D doesn't probably need any special os-dependent treatment and is available in the jsdom) and you, correctly, don't mock if it is present:
jest-canvas-mock/src/window.js
Line 47 in 315d56b
The thing is that you check for a path2d being an instance of Your Path2D (and not the possible already available Path2D)
jest-canvas-mock/src/classes/CanvasRenderingContext2D.js
Lines 705 to 710 in 315d56b
The text was updated successfully, but these errors were encountered: