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

Fatal error running multiple karma targets in one grunt task #153

Closed
brinkkemper opened this issue Jun 18, 2015 · 4 comments
Closed

Fatal error running multiple karma targets in one grunt task #153

brinkkemper opened this issue Jun 18, 2015 · 4 comments

Comments

@brinkkemper
Copy link

We're using Grunt to build multiple, but similar, applications in one build. Each app has files with the same names like HomeController, MenuController. So we split up the karma targets per application so dependencies are loaded only from the shared and specific application being tested. However, we do want all applications to be testes when deploying so we want to run all these targets on after another.

Fatal error
When using grunt to run the multiple karma targets it only runs the first successful and fails to run the second. Fatal error: listen EADDRINUSE The error is somehow related to a port being used.

Grunt-karma config

var dep = [
  'bower_components/**/*.js',
  'app/shared/**/*.js',
];

module.exports = {
  options: {
    configFile: 'test/karma.conf.js',
    reporters: ['brackets', 'html', 'junit', 'coverage'],
    browsers: ['PhantomJS'],
    port: 9002,
    singleRun: true
  },
  A: {
    options: {
      files: dep.concat([       
        'app/A/src/**/*.js'
      ]),      
    }
  },
  B: {
    options: {
      files: dep.concat([
        'app/B/src/**/*.js'
      ]),      
    }
  }
};

when running: grunt karma this ends with a Fatal error: listen EADDRINUSE
I've also create a question on stack overflow. I hope someone can help me out!

@dignifiedquire
Copy link
Member

I think this is the same bug as was tried to be solved in #57

@brinkkemper
Copy link
Author

"tried to be solved"?
Did it make it to a release?
Can I help?

@dignifiedquire
Copy link
Member

See my comment #57 (comment) for what is left to do, as the author has been pretty silent, feel free to create a new PR based on that

@brinkkemper
Copy link
Author

I believe @mokkabonna is right in stating his solution is not ideal and the karma-server should be stopped after completing a singleRun. Abusing the background option doesn't solve the problem.

Workaround
I've managed to run the karma tasks separately by chaining grunt commands on the CML instead of inside a grunt task. that works for us.

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

2 participants