Difference between Karma start and run Karma?
Asked Answered
P

2

14

When I enter 'karma start' in the WebStorms' terminal, it opens Chrome and I can start testing, when I make some changes, it reruns the tests. But what is the difference when I type Karma start or when I click un Run Karma? Is Run Karma only for test reporters?

Persona answered 11/11, 2013 at 19:8 Comment(0)
P
16

There are 2 console commands:

karma start
karma run

Karma start creates a karma server with the given config file and opens a browser window which connects to that server and waits for tests. You should use karma start after every change of your karma.conf.js file. The PhpStorm plugin does this automatically, by run it checks whether the config file is changed, and if so, it executes karma start before karma run.

Karma run sends your tests to the browser and runs them there. Your should use this after every change of your code or unit tests. Ofc the PhpStorm plugin does this automatically by every run.

Presuppose answered 16/1, 2014 at 5:14 Comment(0)
C
1

The standard way is to run karma start and karma run as described by @inf3rno.

When running karma on CI/CD it's good to start karma, run the tests and exit. It's possible to reach using the singleRun: true option in the karma.conf.js. Check it out in the docs http://karma-runner.github.io/1.0/config/configuration-file.html.

Copulation answered 27/4, 2017 at 9:58 Comment(1)
Staying open for me whether or not I try either of these methods, or pass --single-run directly from the CLI.Neighboring

© 2022 - 2024 — McMap. All rights reserved.