Last active
November 3, 2018 20:14
-
-
Save thisismydesign/41280060c46697673fa8d957b85b5f4f to your computer and use it in GitHub Desktop.
No more __snapshots__ folders with Jest! - example configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// config/snapshotResolver.js | |
module.exports = { | |
resolveSnapshotPath: (testPath, snapshotExtension) => testPath + snapshotExtension, | |
resolveTestPath: (snapshotFilePath, snapshotExtension) => snapshotFilePath.slice(0, -snapshotExtension.length), | |
}; | |
// package.json | |
"jest": { | |
"snapshotResolver": "<rootDir>/config/snapshotResolver.js" | |
} | |
// Results in: | |
// . | |
// ├── src | |
// │ ├── components | |
// │ │ ├── App | |
// │ │ │ ├── App.js | |
// │ │ │ ├── App.test.js | |
// │ │ │ ├── App.test.js.snap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment