Explain karma unit test times

2020-04-12 08:43发布

问题:

I've been searching the web for this for two days and I found nothing. Maybe I'm looking in the wrong way — I don't know...

So here it is: what are the times on my console when running a Karma+Jasmine+phantomJs unit test?

... Executed 1 of 1 SUCCESS (0.878 secs / 0.112 secs)

First, I though that the second time is the total unit test time (for example, when running multiple tasks), however, sometimes the first time gets to be 'bigger', sometimes not...

Anyone?

回答1:

total time / net time

  • net time = only test execution (in the browser)
  • total time = how long it took since Karma noticed the file change till the final result was printed (net time + communication with the browser + loading the files in the browser)

See karma/lib/reporters/base.js