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

Test Cases Run Failed Module Not Found Error #21

Closed
Yu-Rou-Weng opened this issue May 31, 2024 · 3 comments
Closed

Test Cases Run Failed Module Not Found Error #21

Yu-Rou-Weng opened this issue May 31, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Yu-Rou-Weng
Copy link
Collaborator

Yu-Rou-Weng commented May 31, 2024

image image image
  • Have tried but not work
    Example:
    1. from 'src/helper/helper.service';
      Change to relative path '../helper/helper.service';
    2. Or add following snippet in tsconfig.ts
"paths": {
 "src/*": [
 "src/*"
 ]
 }
  • Preliminary hypothesis: jest's problem
@Yu-Rou-Weng Yu-Rou-Weng added the bug Something isn't working label May 31, 2024
@YJack0000
Copy link
Owner

You can set jest.config.json or jes.config.ts to make jes aware of baseUrl

@Yu-Rou-Weng
Copy link
Collaborator Author

Thank you very much!

@Yu-Rou-Weng
Copy link
Collaborator Author

I solved it by adding following thing to package.json

"moduleNameMapper": {
    "^src/(.*)$": "<rootDir>/$1"
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants