Support for imports with absolute path
See original GitHub issueDue to issue #58 I found out that unfortunately imports like
import { reposLoaded, repoLoadingError } from 'containers/App/actions';
don’t work with jest and produces next error:
app\containers\HomePage\tests\sagas.test.ts
● Test suite failed to run
Cannot find module 'containers/App/actions' from 'sagas.ts'
at Resolver.resolveModule (node_modules\jest-resolve\build\index.js:151:17)
at Object.<anonymous> (app\containers\HomePage\sagas.ts:8:19)
at Object.<anonymous> (app\containers\HomePage\tests\sagas.test.ts:7:17)
While normal imports with relative paths behave as expected. It could be problem of jest-resolve
module, but we have to try to solve it inside ts-jest
or find what exactly causes this problem in jest-resolve
.
As always we have to start from tests for this case.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:22
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Understand and Configure Absolute Import Paths in JavaScript
An absolute import path is a path that starts from a root, and you need to define a root first. In a typical...
Read more >Advanced Features: Absolute Imports and Module Path Aliases
Configure module path aliases that allow you to remap certain import paths. ... Next.js automatically supports the tsconfig.json and jsconfig.json "paths" ...
Read more >Use Absolute Paths with React - Better Programming
By default, relative paths are the supported way of importing modules to React and other frameworks. You will usually see or write something ......
Read more >Making Life Easier with Absolute Imports - React in Javascript ...
According to create-react-app Docs, We can use absolute imports in our react project by configuring a jsconfig. json / tsconfig. json (for ...
Read more >Absolute vs Relative Imports in Python
An absolute import specifies the resource to be imported using its full path from the project's root folder. Syntax and Practical Examples. Let's...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t see anywhere this module passing options to jest-resolve. Putting the extra moduleDirectories in
package.json
jest
object works for my case:What if this is still an Issue?