Skip to content

Instantly share code, notes, and snippets.

@swcho
Created April 10, 2018 06:42
Show Gist options
  • Save swcho/28d0871645fc4c6016363fcd56aa5380 to your computer and use it in GitHub Desktop.
Save swcho/28d0871645fc4c6016363fcd56aa5380 to your computer and use it in GitHub Desktop.
Just Jest Config
module.exports = {
verbose: true,
"moduleDirectories": ["node_modules", "src"],
globals: {
"__TS_CONFIG__": {
"module": "es2016",
"allowjs": true,
},
"ts-jest": {
"tsConfigFile": "src/fe/tsconfig.test.json",
// "useBabelrc": true,
"skipBabel": true
},
// https://codereviewvideos.com/course/react-redux-and-redux-saga-with-symfony-3/video/using-webpack-environment-variables-in-jest-tests
"RUNTIME_BROWSER": true,
"FE_ENV_TARGET": "test",
},
"transform": {
"^.+\\.(t|j)sx?$": "ts-jest"
},
// https://medium.com/@martin_hotell/tree-shake-lodash-with-webpack-jest-and-typescript-2734fa13b5cd
"transformIgnorePatterns": [
"<rootDir>/node_modules/(?!(lodash-es)/.*)",
],
// "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
testRegex: "src/fe/stories/storyshot.test.tsx",
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/fe/stories/jest/mock.file.js",
// "\\.(css|less)$": "<rootDir>/test/utils/mock.style.js",
"\\.(css|less)$": "identity-obj-proxy",
// "\\.(html)$": "<rootDir>/__mocks__/htmlMock.js",
"react-addons-css-transition-group": "<rootDir>/src/fe/stories/jest/react_css_transition_group.js",
"react-sizeme": "<rootDir>/src/fe/stories/jest/react-sizeme.js",
},
// https://github.com/facebook/jest/issues/771
// for ndc-gitbook
"modulePathIgnorePatterns": [
"ssr"
]
// "unmockedModulePathPatterns": [
// "redux-mock-store",
// // "react",
// // "enzyme",
// // "jest-enzyme"
// ],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment