This repository was archived by the owner on Jan 26, 2019. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 488
This repository was archived by the owner on Jan 26, 2019. It is now read-only.
Jest doesn't resolve absolute paths from tsconfig #456
Copy link
Copy link
Open
Description
When running quick test:
import * as React from 'react'; import { shallow } from 'enzyme'; import App from '../App'; it('renders without crashing', () => { shallow(<App />); });
I got error in Jest:
'Cannot find module '@store' from 'App.tsx'
My tsconfig:
{ "compilerOptions": { "paths": { "@store": ["./store"], "@store/*": ["store/*"], "@scenes/*": ["scenes/*"], "@scenes": ["scenes"], "@components/*": ["components/*"], "@components": ["components"], "@utils": ["utils"], "@utils/*": ["utils/*"], "@api": ["./api"], "@constants/*": ["constants/*"], "@constants": ["constants"], "@assets/*": ["assets/*"], "@containers/*": ["containers/*"], "@containers": ["containers"], "@theme": ["theme"], "@types": ["types"] }, "baseUrl": "./src", "outDir": "build/dist", "module": "esnext", "target": "es5", "lib": ["es6", "es7", "dom"], "sourceMap": true, "allowJs": true, "jsx": "react", "moduleResolution": "node", "rootDir": "./", "forceConsistentCasingInFileNames": true, "noImplicitReturns": true, "noImplicitThis": true, "noImplicitAny": false, "importHelpers": true, "strictNullChecks": true, "suppressImplicitAnyIndexErrors": true, "allowSyntheticDefaultImports": true, "noUnusedLocals": true, "noUnusedParameters": true }, "exclude": [ "node_modules", "build", "scripts", "acceptance-tests", "webpack", "jest", "src/setupTests.ts" // "src/modules" ] }
App is running successfully. But jest can't resolve absolute paths from tsconfig. What should i do to fix this?
Metadata
Metadata
Assignees
Labels
No labels