Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

TS aliases are not recognized in tests #279

Closed
farzadmf opened this issue Mar 19, 2018 · 5 comments
Closed

TS aliases are not recognized in tests #279

farzadmf opened this issue Mar 19, 2018 · 5 comments

Comments

@farzadmf
Copy link

Hi,

I'm using aliases in my tsconfig.json; something like this

  // ...
  "baseUrl": "./",
  "paths": {
    "Common/*": ["src/common/*"],
    "Components/*": ["src/components/*"],
    "Containers/*": ["src/containers/*"],
    "Store/*": ["src/store/*"]
  }

But when I run the tests, I see error messages regarding Cannot find module ..., which is pointing to the aliases I'm using in the code

Can you please help we with this regard? I saw an issue talking about a similar thing, but I don't think I saw aliases being mentioned there.

Thank you in advance

@nnyegaard
Copy link

I think you also need to setup aliases in webpack, and to do that you need to eject.

@farzadmf
Copy link
Author

The thing is that I prefer not to eject the application

@nnyegaard
Copy link

I don't think it's possible.

@untsamphan
Copy link

Since #303 was merged and released, now it should be possible to fix the issue by providing Jest moduleNameMapper.

@farzadmf
Copy link
Author

farzadmf commented Jun 3, 2018

You're right @untsamphan , thank you

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants