Skip to content

Instantly share code, notes, and snippets.

@kisildev
Created November 26, 2019 12:14
Show Gist options
  • Save kisildev/4bc0caf26f6d84c0e935c97c74c2de7a to your computer and use it in GitHub Desktop.
Save kisildev/4bc0caf26f6d84c0e935c97c74c2de7a to your computer and use it in GitHub Desktop.
Jest + Enzyme + Typescript (based on parcel)
1) npm i jest --save-dev
2) npm i @types/jest ts-jest —save-dev
3) create jest.config.js
---------------------------
module.exports = {
"roots": [
"<rootDir>/src"
],
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"snapshotSerializers": ["enzyme-to-json/serializer"],
}
---------------------
4) npm i enzyme @types/enzyme enzyme-to-json enzyme-adapter-react-16 —save-dev
5) in jest.config.js -> "snapshotSerializers": ["enzyme-to-json/serializer"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment