TypeScripter
TypeScripter

Reputation: 909

Is it possible to run parallel tests using karma

At the moment we have close to 1000 unit tests written in jasmine/typescript. When I run them all they take as much as 5 mins on chrome. We do have some unit tests which deals with DOM as well. e.g. verify if a button exists with specified text. We have a number of files where these tests are distributed. We have noticed that when we run individual files and sum up total time taken, it is far less than that of when we run all tests in one go. That's why we are thinking if there is a way to run tests in parallel? The plan is to divide tests and run them in parallel.

Upvotes: 19

Views: 15743

Answers (1)

Joel Jeske
Joel Jeske

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']
  });
};

karma-parallel

Disclosure: I am the author

Upvotes: 29

Related Questions