Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular-cli - Use multiple karma.conf.js

I am using angular-cli and I want to use two karma.conf.js files for testing.

  1. For CI : For which I am using Headless Chrome

    customLaunchers: {

      ChromeHeadless: {
        base: 'Chrome',
        flags: [
          '--headless',
          '--disable-gpu',
          // Without a remote debugging port, Google Chrome exits immediately.
          '--remote-debugging-port=9222',
        ],
      }
    }
    
  2. For Dev : For which I am using Chrome.

Is there any way that I could switch betwwen two karma.conf.js based on an argument value.

like image 354
lohiarahul Avatar asked Aug 30 '17 05:08

lohiarahul


2 Answers

You can use option karmaConfig:

ng test --karmaConfig=another-karma.config.json

You may want to check ng test --help=true for other options.

like image 109
fhdhsni Avatar answered Oct 25 '22 02:10

fhdhsni


In the Angular CLI v6 the option name got changed: ng test --karma-config <your config here>

like image 29
Josh Avatar answered Oct 25 '22 02:10

Josh