webduvet
webduvet

Reputation: 4292

How to suppress output for skipped tests in Jasmine

If I have the scenario with 1000+ tests and want to run only selected portion of them I can use fdescribe.

The rest of tests are skipped which is great however they still pollute the console output. How can I suppress the console output for skipped tests?

Upvotes: 22

Views: 7179

Answers (2)

Snekse
Snekse

Reputation: 15789

If you're running tests via Karma, there is a spec reporter plugin that you can configure to ignore various things.

https://www.npmjs.com/package/karma-spec-reporter

https://www.npmjs.com/package/karma-spec-reporter-2

Add the following to your karma.conf.js:

...
  config.set({
    ...
      reporters: ["spec"],
      specReporter: {
        suppressSkipped: true, // do not print information about skipped tests 
      },
      plugins: ["karma-spec-reporter"],
    ...

If you're not using Karma, then you need to find the proper Jasmine reporter and configure it, or create your own reporter.

https://www.npmjs.com/package/jasmine2-reporter

Upvotes: 29

Graham P Heath
Graham P Heath

Reputation: 7389

If you're using the mocha reporter:

reporters: ['mocha'],

mochaReporter: {
  ignoreSkipped: true,
},

Upvotes: 22

Related Questions