Skip to content

Karma task: Wrong path to karma.conf.js #247

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

Closed
melo0187 opened this issue Jun 2, 2014 · 7 comments
Closed

Karma task: Wrong path to karma.conf.js #247

melo0187 opened this issue Jun 2, 2014 · 7 comments
Labels

Comments

@melo0187
Copy link

melo0187 commented Jun 2, 2014

When generating a new app and running grunt test you get:
ERROR [config]: File /path/to/projectroot/karma.conf.js does not exist!

I had a look at Gruntfile.js (lines 396 - 402)

    // Test settings
    karma: {
      unit: {
        configFile: 'karma.conf.js',
        singleRun: true
      }
    },

The file is actually not in the project's root, but in test/. Changing line 399 from
configFile: 'karma.conf.js' to configFile: 'test/karma.conf.js' solved the issue for me.

@JaKXz
Copy link
Collaborator

JaKXz commented Jun 2, 2014

@melo0187 this would be great for your first PR!

@JaKXz JaKXz added the bug label Jun 2, 2014
@melo0187
Copy link
Author

melo0187 commented Jun 2, 2014

On it's way. Could become tomorrow morning though.

@JaKXz
Copy link
Collaborator

JaKXz commented Jun 4, 2014

Just to note: my project [generated with an older version] has the karma.conf.js in the root folder. I definitely agree that it's better off in the test/ folder; I'm glad someone caught this regression, thanks @melo0187.

@JaKXz JaKXz assigned DaftMonk and unassigned DaftMonk Jun 4, 2014
@melo0187
Copy link
Author

melo0187 commented Jun 4, 2014

@JaKXz I'm happy to hear that I helped =)
Can this regression be fixed with my PR or did I get it wrong? Still don't have much knowledge about how the generator works behind the scenes.

@royling
Copy link

royling commented Jun 15, 2014

@melo0187 I did not figure out how karma.conf.js is generated behind the scenes yet. However, I think it's necessary to change somewhere to generate it into test folder. Further more, it would be perfect if the basePath can be set as root (i.e. ..), then all files configured as files can be resolved from root directory still (this would make the solution in #251 better).

@JaKXz
Copy link
Collaborator

JaKXz commented Jun 15, 2014

@royling karma.conf.js is generated by generator-karma. What I would suggest to fix this issue is simply to correct your Gruntfile manually, since there are a lot of structural changes improvements in the upcoming version of this generator, which you can try out like so.

@JaKXz JaKXz closed this as completed Jun 15, 2014
@JaKXz JaKXz reopened this Jun 15, 2014
@royling
Copy link

royling commented Jun 16, 2014

@JaKXz Thank you for pointing out the upcoming major structure change, looking forward to v2.0. For now, I already fixed the problem by manually changing the path in Gruntfile.js as well as correcting all file paths in generated karma.conf.js as below:

basePath: '..',
...
files: [
      'app/bower_components/angular/angular.js',
      'app/bower_components/angular-mocks/angular-mocks.js',
      'app/bower_components/angular-resource/angular-resource.js',
      'app/bower_components/angular-cookies/angular-cookies.js',
      'app/bower_components/angular-sanitize/angular-sanitize.js',
      'app/bower_components/angular-route/angular-route.js',
      'app/scripts/*.js',
      'app/scripts/**/*.js',
      'test/client/spec/**/*.js'
]

@JaKXz JaKXz closed this as completed Jul 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants