Jest not able to resolve subpaths with / only with \\ #4186
Unanswered
BillyCottrell
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
So I am currently building an environment for AWS together with the SST framework.
I made a Lambda with an express server behind it and this is currently what I am trying to setup jest for.
This is my current file structure:
So inside my functions directory I have a separate package.json, tsconfig.json and jest.config.ts file.
Now my tests work but I am unable to access the core directory.
In my tsconfig I have the following path configured:
I tried to add this inside my jest config like this:
Which does work for paths like:
@packages/core/controllers
, but not when a subpath is added as it is unable to resolve it and gives the following error:The only way I could get it to work was if I changed my import, from using "/" to using "\" as then it was able to resolve it without an issue. Probably because its trying to resolve the path like this:
Which obviously doesn't work.
So now my question is am I doing something wrong here do I need to change my configuration or do I just update my imports to use "\" instead?
FYI, I am using the following dependencies:
Hope someone can clear this out for me!
Thanks in advance!
Kind regards,
Billy
Beta Was this translation helpful? Give feedback.
All reactions