ZweiEuroZ
Deno11mo ago
46 replies
ZweiEuro

Test using png mocks

When using imports with *.png files it will crash denos testing system with a warning:
error: Expected a JavaScript or TypeScript module, but identified a Unknown module. Importing these types of modules is currently not supported.
  Specifier: file:///home/zweieuro/Documents/uni/2023_SS/WUI/html_UI/vivaci_ui_deno/client/src/player_life.png


While I understand the problem, how can i mock away the png and replace it with an identity object or something similar?
In jest i would transform it away (https://stackoverflow.com/questions/46898638/importing-images-breaks-jest-test) but i am not sure how deno would handle this
Stack Overflow
In React components importing assets
(ex, import logo from "../../../assets/img/logo.png)
gives such error
({"Object.":function(module,exports,require,dirname,filename,global,jest){�PNG...
Importing images breaks jest test
Was this page helpful?