wobsoriano / vitest-canvas-mock

🌗 A module used to mock canvas in Vitest.
MIT License
53 stars 8 forks source link

Fix getCanvasWindow import #1

Closed yannbf closed 1 year ago

yannbf commented 1 year ago

Thank you so much for this library! While I was setting it up, I was getting this issue:

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
TypeError: getCanvasWindow is not a function
 ❯ importMockWindow node_modules/vitest-canvas-mock/dist/index.js:20:24
     18|     return(res.default || res)});
     19|   const canvasWindow = getCanvasWindow({ document: window.document });
     20|   apis.forEach((api) => {
       |                        ^
     21|     global[api] = canvasWindow[api];
     22|     global.window[api] = canvasWindow[api];

This PR proposes a fix for that issue.

wobsoriano commented 1 year ago

Thanks!

yannbf commented 1 year ago

Hey @wobsoriano, I saw you made a new release but I think the fix didn't get in?

wobsoriano commented 1 year ago

Yeah that's weird 😆

Released another one

yannbf commented 1 year ago

Yeah that's weird 😆

Released another one

that worked! <3