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
Using latest heatmap.js with Canvas in a jest test leads to errors. It fails with:
TypeError: offset required
43 | function createHeatmap(parent: HTMLElement, heatData: HeatData[]) {
44 | return heatmap
> 45 | .create({
| ^
46 | container: parent
47 | })
48 | .setData({
at _getColorPalette (../../node_modules/heatmap.js/build/heatmap.js:262:16)
at new Canvas2dRenderer (../../node_modules/heatmap.js/build/heatmap.js:355:21)
at new Heatmap (../../node_modules/heatmap.js/build/heatmap.js:650:24)
at Object.create (../../node_modules/heatmap.js/build/heatmap.js:715:12)
at createHeatmap (src/SVGHeatmap.tsx:45:6)
at src/SVGHeatmap.tsx:81:21
at commitHookEffectList (../../node_modules/react-dom/cjs/react-dom.development.js:22030:26)
at commitPassiveHookEffects (../../node_modules/react-dom/cjs/react-dom.development.js:22064:11)
at HTMLUnknownElement.callCallback (../../node_modules/react-dom/cjs/react-dom.development.js:336:14)
at innerInvokeEventListeners (../../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:316:27)
Using latest heatmap.js with Canvas in a jest test leads to errors. It fails with:
This is the line that throws the error:
https://github.com/pa7/heatmap.js/blob/master/src/renderer/canvas2d.js#L14
The reason is explained here:
https://stackoverflow.com/questions/62332852/how-to-create-gradient-text-in-canvas-nodejs
And you can see that in the node js canvas there's indeed a type check:
https://github.com/Automattic/node-canvas/blob/fe186e5f1e720eca598212fdc6edf16766c21ec0/src/CanvasGradient.cc#L77
Solution is simple parse the string to number.
The text was updated successfully, but these errors were encountered: