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

Hardcoded module names #5

Closed
intellix opened this issue Apr 4, 2017 · 1 comment
Closed

Hardcoded module names #5

intellix opened this issue Apr 4, 2017 · 1 comment

Comments

@intellix
Copy link
Contributor

intellix commented Apr 4, 2017

Just got everything working and am now getting errors that it can't find a couple of modules/files during my tests:

Cannot find module 'testing/api-http-service.stub' from 'user.service.spec.ts'
Cannot find module 'testing/user-service.stub' from 'register-form.component.spec.ts'

I've got a folder inside /src called testing and import stubs for my tests like:

import { RouterStub } from 'testing/router.stub';

Was trying to figure out why and I see jest-preset only whitelists app and environments like:

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

Angular CLI allows anything inside src

@intellix
Copy link
Contributor Author

intellix commented Apr 4, 2017

This seems to work:

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

JLHwung pushed a commit to JLHwung/jest-preset-angular that referenced this issue Dec 13, 2018
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

1 participant