Skip to content

Commit

Permalink
jest-preset: handle static assets for next/image (#2763)
Browse files Browse the repository at this point in the history
(patch)
  • Loading branch information
beerose authored Oct 1, 2021
1 parent f5829db commit 99f146e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/blitz/jest-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ const common = {
(tsConfig && tsConfig.compilerOptions && tsConfig.compilerOptions.paths) || {},
),
"\\.(css|less|sass|scss)$": path.resolve(__dirname, "./jest-preset/identity-obj-proxy.js"),
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": path.resolve(
"\\.(eot|otf|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": path.resolve(
__dirname,
"./jest-preset/file-mock.js",
),
"\\.(jpg|jpeg|png|gif|webp|ico)$": path.resolve(__dirname, "./jest-preset/image-mock.js"),
},
watchPlugins: ["jest-watch-typeahead/filename", "jest-watch-typeahead/testname"],
// Coverage output
Expand Down
5 changes: 5 additions & 0 deletions packages/blitz/jest-preset/image-mock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
src: "/public/test.png",
width: 100,
height: 100,
}

0 comments on commit 99f146e

Please sign in to comment.