DiamondLightSource / cs-web-lib

Library form of control system web UI prototype
Apache License 2.0
1 stars 1 forks source link

Console errors in tests #22

Closed rjwills28 closed 1 year ago

rjwills28 commented 1 year ago

Something is missing in the test environment causing multiple console.errors to be printed when running the tests. The error is related to the use of the plotly.js module and the fact that the tests do not have a canvas to paint on (I think? - see error below.). Note that these do not cause the tests to fail but it is a bit annoying to have to see all these errors printed. You can also see them in the recent CI jobs.

console.error
      Error: Not implemented: HTMLCanvasElement.prototype.getContext (without installing the canvas npm package)
          at module.exports (/home/cnuser/cs-web-proto/cs-web-lib/node_modules/jsdom/lib/jsdom/browser/not-implemented.js:9:17)
          at HTMLCanvasElementImpl.getContext (/home/cnuser/cs-web-proto/cs-web-lib/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js:42:5)
          at HTMLCanvasElement.getContext (/home/cnuser/cs-web-proto/cs-web-lib/node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js:131:58)
          at Object.42505 (/home/cnuser/cs-web-proto/cs-web-lib/node_modules/plotly.js/dist/plotly.js:156927:42)
          at __webpack_require__ (/home/cnuser/cs-web-proto/cs-web-lib/node_modules/plotly.js/dist/plotly.js:222552:42)
          at Object.26787 (/home/cnuser/cs-web-proto/cs-web-lib/node_modules/plotly.js/dist/plotly.js:98289:12)
          at __webpack_require__ (/home/cnuser/cs-web-proto/cs-web-lib/node_modules/plotly.js/dist/plotly.js:222552:42)
          at Object.68868 (/home/cnuser/cs-web-proto/cs-web-lib/node_modules/plotly.js/dist/plotly.js:98275:14)
          at __webpack_require__ (/home/cnuser/cs-web-proto/cs-web-lib/node_modules/plotly.js/dist/plotly.js:222552:42)
          at Object.21641 (/home/cnuser/cs-web-proto/cs-web-lib/node_modules/plotly.js/dist/plotly.js:481:18) undefined
rjwills28 commented 1 year ago

Fixed in PR #23 .