mirror of
https://github.com/status-im/react-native.git
synced 2025-01-12 10:34:57 +00:00
Fix jest snapshot testing on windows
Summary: Fixes #19370 Applied changes to existing project that uses jest snapshot testing. Testing was broken before and now works. To verify: Run any snapshot test containing an image reference on Windows before and after this PR. [WINDOWS][BUGFIX][jest] - Fixed jest snapshot testing on windows Closes https://github.com/facebook/react-native/pull/19496 Differential Revision: D8195947 Pulled By: hramos fbshipit-source-id: 909b5fe7cfd8c6286baf161a227a359854a37603
This commit is contained in:
parent
fecfa2a553
commit
216bce3163
@ -15,7 +15,7 @@
|
||||
],
|
||||
"transform": {
|
||||
"^.+\\.js$": "babel-jest",
|
||||
"^[./a-zA-Z0-9$_-]+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$": "<rootDir>/node_modules/react-native/jest/assetFileTransformer.js"
|
||||
"^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$": "<rootDir>/node_modules/react-native/jest/assetFileTransformer.js"
|
||||
},
|
||||
"transformIgnorePatterns": [
|
||||
"node_modules/(?!(jest-)?react-native|react-clone-referenced-element)"
|
||||
|
@ -21,7 +21,10 @@ module.exports = {
|
||||
// the Jest snapshot.
|
||||
process: (_, filename) =>
|
||||
`module.exports = {
|
||||
testUri: ${JSON.stringify(path.relative(__dirname, filename))}
|
||||
testUri:
|
||||
${JSON.stringify(
|
||||
path.relative(__dirname, filename).replace(/\\/g, '/'),
|
||||
)}
|
||||
};`,
|
||||
getCacheKey: createCacheKeyFunction([__filename]),
|
||||
};
|
||||
|
@ -20,7 +20,7 @@
|
||||
},
|
||||
"jest": {
|
||||
"transform": {
|
||||
"^[./a-zA-Z0-9$_-]+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$": "<rootDir>/jest/assetFileTransformer.js",
|
||||
"^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$": "<rootDir>/jest/assetFileTransformer.js",
|
||||
".*": "./jest/preprocessor.js"
|
||||
},
|
||||
"setupFiles": [
|
||||
|
Loading…
x
Reference in New Issue
Block a user