Reputation: 1221
We have an AngularJS project with about 20K LOC and 80% test coverage, so we have a lot more tests than Karma will run in one group. We've looked at fixing the memory leaks, but between the AngularJS injector, ui-router, and closures for each describe and it spec, it feels like a problem too large to fix.
So, we have resorted to splitting out our tests into groups. This works well until a group starts to exceed about 1,200 tests, and then it just starts slowing down until we add enough to eventually crash the browser.
I recently got rid of the manual management of splitting out the tests, and just have gulp iterate over each of the source directories and create a task with gulp.task for each one.
It works, but it kind of feels like I'm pushing against how gulp wants to work rather than letting it do the work for me.
Is there a plugin or better way to approach this?
Upvotes: 2
Views: 981
Reputation: 1647
You can use karma-parallel to split up your tests across multiple browser instances. It runs specs in different browser instances and is very simple and easy to install:
npm i karma-parallel
and then add the 'parallel' to the frameworks list in karma.conf.js
module.exports = function(config) {
config.set({
frameworks: ['parallel', 'jasmine']
});
};
Disclosure: I am the author
Upvotes: 3