1

When I execute the test with vue-cli-service, I imported a component that contain amcharts4 to spec file then run command vue-cli-service test:unit

I got the error Module not found: 'canvas' in '\node_modules@amcharts\amcharts4\node_modules\canvg\dist\node'

Console log

Error in ./node_modules/@amcharts/amcharts4/node_modules/canvg/dist/node/canvg.js

  Module not found: 'canvas' in 'E:\Project\...\node_modules\@amcharts\amcharts4\node_modules\canvg\dist\node'

Error in ./node_modules/jsdom/lib/jsdom/utils.js

  Module not found: 'canvas' in 'E:\Project\...\node_modules\jsdom\lib\jsdom'

 ERROR  mocha-webpack exited with code 1.

Setup.js

require('jsdom-global')(undefined, { url: 'https://localhost' });

global.localStorage = window.localStorage;

global.sessionStorage = window.sessionStorage;
window.Date = Date;

Please help me to resolve this issue!

Ivo Mullen
  • 11
  • 1

0 Answers0