-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Karma 0.12 + Requirejs: Karma looks for spec in the src directory #1120
Closed
topher-brennan opened this issue
Jun 30, 2014
· 1 comment
· Fixed by #1346 · May be fixed by Omrisnyk/npm-lockfiles#122 or Omrisnyk/npm-lockfiles#132
Closed
Karma 0.12 + Requirejs: Karma looks for spec in the src directory #1120
topher-brennan opened this issue
Jun 30, 2014
· 1 comment
· Fixed by #1346 · May be fixed by Omrisnyk/npm-lockfiles#122 or Omrisnyk/npm-lockfiles#132
Comments
Had the same problem and ended up using the same fix. The thing is that the code from the v0.10 returns the correct path.
The v0.12 introduces the
I guess it was part of something else that hasn't yet been updated. |
freethejazz
added a commit
to freethejazz/karma
that referenced
this issue
Mar 12, 2015
The `pathToModule` function sets a project up such that your spec directory must be within your src directory. This approach directly contradicts the example describing how to use RequireJS with Karma in the documentation. Fixes karma-runner#1120, fixes karma-runner#896
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm using Karma 0.12 and struggling to get it to work with Requirejs. I've been trying to follow this guide slavishly, but something isn't working.
My file structure looks like this (note that this is a large project, so I'll only give a partial listing. Importantly, many of the files in the /src directory have dependencies which I will not list):
$ project
|--SpecRunner.html
|--my.conf.js
|--src
| |--main.js
| |--rvv
| | |--rvv.js
| |--engage
| |--new_campaign.js
| |--engage.js
|--spec
|--test-main.js
|--engage
|--new_campaign_spec.js
Here's my config file:
And here's test-main.js:
Note that the shim and paths options, above, are copied from main.js and the baseUrl in main.js is '/src.'
May as well include new_campaign_spec.js for good measure:
Okay, now here's what happens when I try to make this work. I get the following error message:
It basically seems like Karma is expecting my /spec folder to be within the /src folder. But if the guide to using Karma with Requires linked at the top of this issue is correct, then I'm really confused, because as far as I can tell I followed that guide exactly.
Note that changing the baseURL in test-main.js to just '/base' gets different error messages: nothing about the spec file, but now it's having issues finding the files in the /spec folder. Adding /src to the beginning of the file paths in new_campaign_spec.js isn't a solution, because then the issue is resolving the dependencies of the files required in new_campaign_spec.js. Perhaps I could solve the problem by then altering the paths for the dependencies in the /src directory, but then I'm on my way to completely re-doing how I handle dependency paths throughout the project. It doesn't seem like doing that should be necessary, and knowing I could do that if I have to wouldn't explain why I'm having this problem in the first place.
Edit: I tried following the advice in this StackOverflow entry, and once again this seems to fix the resolution of some paths but break other paths.
The text was updated successfully, but these errors were encountered: