Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with path aliases #23

Closed
julianklumpers opened this issue Mar 3, 2021 · 6 comments
Closed

Not working with path aliases #23

julianklumpers opened this issue Mar 3, 2021 · 6 comments

Comments

@julianklumpers
Copy link

julianklumpers commented Mar 3, 2021

Problem:
When having path aliases in your project. the transformer cannot resolve the file.

Cannot find module '@src/utils/fixtureGenerator/FixtureGenerator'

referring to this issue: evanw/esbuild#38
It should be fixed by adding a jsconfig.json but its not working.

Is there a way to configure this or will this be supported in the near future?

@aelbore
Copy link
Owner

aelbore commented Mar 4, 2021

@julianklumpers thanks for raising this issue, i think i should add the tsconfig options i check on this and let you know.

@aelbore
Copy link
Owner

aelbore commented Mar 6, 2021

@julianklumpers for the meantime you do this as workaround in you jest.config.js

  moduleNameMapper: {
    "@src/utils/fixtureGenerator/FixtureGenerator": "<rootDir>/your-path-of-genarator-here"
  },

@aelbore
Copy link
Owner

aelbore commented Mar 6, 2021

@julianklumpers i found this, can you install alias-hq and check out there documentation
https://github.com/davestewart/alias-hq/blob/master/docs/integrations.md

let me know if resolve your issue.

@julianklumpers
Copy link
Author

@julianklumpers for the meantime you do this as workaround in you jest.config.js

  moduleNameMapper: {
    "@src/utils/fixtureGenerator/FixtureGenerator": "<rootDir>/your-path-of-genarator-here"
  },

I believe that will also mock the module. the module is used in conjunction with MSWJS so i cannot be mocked.
I will get back here after i'm 100% sure about this.

Thank you for your reply

@aelbore
Copy link
Owner

aelbore commented Mar 11, 2021

@julianklumpers it will not mock the module please see examples
./examples/ts-jsconfig-paths

on this repository

@aelbore
Copy link
Owner

aelbore commented Apr 23, 2021

closing on this please create new issue if you still have issues.

@aelbore aelbore closed this as completed Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants