Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NG Test show names in console

It can be quite difficult to identify a failing test when there is a fairly generic error (yes source maps is false) and would help greatly if we could show the test name instead of "executed 27 of 172"

enter image description here

Something like "executed 27 (TextActivityService Test) of 172

I'm referring here to when all tests pass but the console is reporting errors.

Is this possible?

like image 290
72GM Avatar asked Dec 31 '18 11:12

72GM


1 Answers

You need to use Karma Spec Reporter.

Usage:

  1. To use in your own Node.js project, just execute

npm install karma-spec-reporter --save-dev

  1. Then add 'spec' to reporters in karma.conf.js

// karma.conf.js

...
  config.set({
  ...
    reporters: ["spec"],
    specReporter: {
      maxLogLines: 5,         // limit number of lines logged per test
      suppressErrorSummary: true,  // do not print error summary
      suppressFailed: false,  // do not print information about failed tests
      suppressPassed: false,  // do not print information about passed tests
      suppressSkipped: true,  // do not print information about skipped tests
      showSpecTiming: false // print the time elapsed for each spec
    },
    plugins: ["karma-spec-reporter"],
  ...
like image 149
Valdas G Avatar answered Sep 28 '22 04:09

Valdas G