Closed
Description
I reported this in create-react-app:
If you use the Webpack feature to import an asset (CSS/images) from a scoped npm module then Jest will treat the asset as JS code and the test will fail.
import logo from '@myscope/my-component/logo.png'
Results in an error like this:
FAIL src\App.test.js
● Test suite failed to run
C:\Users\<user>\Projects\my-app\node_modules\@myscope\my-component\logo.png:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){�PNG
^
SyntaxError: Unexpected token ILLEGAL
at transformAndBuildScript (node_modules\react-scripts\node_modules\jest-runtime\build\transform.js:284:10)
at Object.<anonymous> (src\App.js:3:38)
at Object.<anonymous> (src\App.test.js:3:38)
Metadata
Metadata
Assignees
Labels
No labels