Skip to content

Commit

Permalink
fix(jest): make assetFileTransformer return object
Browse files Browse the repository at this point in the history
Fixes #33751
Relates to #33576
  • Loading branch information
geraintwhite authored and Geraint White committed Jun 17, 2022
1 parent d881c87 commit 951031b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jest/assetFileTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ module.exports = {
// the correct images are loaded for components. Essentially
// require('img1.png') becomes `Object { "testUri": 'path/to/img1.png' }` in
// the Jest snapshot.
process: (_, filename) =>
`module.exports = {
process: (_, filename) => ({
code: `module.exports = {
testUri:
${JSON.stringify(
path.relative(__dirname, filename).replace(/\\/g, '/'),
)}
};`,
}),
getCacheKey: createCacheKeyFunction([__filename]),
};

0 comments on commit 951031b

Please sign in to comment.