Skip to content

Instantly share code, notes, and snippets.

@admhpr
Created September 12, 2018 16:37
Show Gist options
  • Save admhpr/37b7743bc0b3a012bbb35279726abfd9 to your computer and use it in GitHub Desktop.
Save admhpr/37b7743bc0b3a012bbb35279726abfd9 to your computer and use it in GitHub Desktop.
Jest Enzyme and Typescript
/*
* Add to __tests__/setup/
*/
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
configure({ adapter: new Adapter() })
module.exports = {
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
setupFiles: ['<rootDir>/src/__tests__/setup/enzyme.ts'],
testRegex: '(/__tests__/^/(?!setup$).*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
'<rootDir>/docker_node_modules/',
'<rootDir>src/__tests__/setup/',
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
};
/**
* ts ❤ ⚛️
*/
{
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false,
"baseUrl": ".",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"lib": [
"dom",
"es6"
],
"module": "esnext",
"moduleResolution": "node",
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"skipLibCheck": true,
"noUnusedLocals": true,
"outDir": "dist/",
"paths": {
"@core/*": ["src/core/*"],
"@data/*": ["src/data/*"],
"@pages/*": ["src/pages/*"],
"@interfaces/*": ["src/interfaces/*"],
"@layouts/*": ["src/core/layouts/*"],
"@processes/*": ["src/processes/*"],
"@redux/*": ["src/redux/*"],
"@router/*": ["src/core/router/*"],
"@tasks/*": ["src/tasks/*"],
"@users/*": ["src/core/users/*"],
"@utils/*": ["src/core/utils/*"],
"@widgets/*": ["src/widgets/*"]
},
"preserveConstEnums": true,
"removeComments": true,
"sourceMap": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"target": "es5",
"types": [
"webpack-env"
]
},
"exclude": ["node_modules", "dist", "**/__tests__/*"],
"include": ["./src/**/*"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment