start minimized browser instance with Karma

Everytime I start karma with for testing, a new instance of browser is opened (Firefox in my case). This is annoying because it pops out over the other windows (I am using windows 8).

Is there any karma configuration to make it start minimized? Or maybe another solution which would solve my problem.


The best I've found for Chrome is to set the window-size. It still maximizes but at least you can quickly hit the Restore button to resize it to a small window. I couldn't find an option to not open maximized http://peter.sh/experiments/chromium-command-line-switches/

Here's the Karma config:

browsers: ['Chrome_small'],

customLaunchers: {
  Chrome_small: {
    base: 'Chrome',
    flags: ['--window-size=400,400']
  }
}

Building off of @Jeff Sheets great answer, you can position the window off the screen using the --window-position flag, so it's at least out of your way if not actually minimized. It's also good for multiple monitor situations:

    browsers: ['Chrome_small'],

    customLaunchers: {
      Chrome_small: {
        base: 'Chrome',
        flags: [
            '--window-size=400,400',
            '--window-position=-400,0'
        ]
      }
    }

Firefox

No, you cannot at the moment. There's an issue on the repo for that but it hasn't been closed yet.

While it is possible to pass some user preferences, there's not yet the option to pass the -tray command line option described here.

Chrome

Update 2022; below causes errors, like:

Chrome failed 2 times (cannot start). Giving up.

You can definitely add flags to the Chrome launcher configuration.
I'm not sure you can do what you are looking for tough: the only thing I found is the --no-startup-window flag.
Add it to the launcher configuration section and let us know if it works for your purpose.
Have a look at the launcher documentation to see how to add flags.


Consider ChromeHeadless. Comes with the karma Chrome launcher.

browsers: [
   'ChromeHeadless'
]