1.0.6 • Published 8 years ago

karma-and-protractor-reporter v1.0.6

Weekly downloads
13
License
ISC
Repository
github
Last release
8 years ago

karma-and-protractor-reporter

A command line reporter for protractor and karma for Test Driven Development. The output is compact and has stacktrace highlighting so it's easy to see which tests are failing as quickly as possible.

How does it looks

The output looks similar in protractor or karma. The protractor stacktrace is filtered (depending on options used) so that jasmine and protractor internals are not shown.

Installation

To install use npm install karma-and-protractor-reporter --save-dev.

Karma Configuration

// karma.conf.js
module.exports = function(config) {
  config.set({
    frameworks: ['jasmine'],

    // reporters configuration
    reporters: ['mocha'],
    kap: {
      useColors: true,
      showTiming: true,
      style: 'dots',
      stackStyle: 'summary'
    }
  });
};

Protractor Configuration

// protractor.conf.js
exports.config = {
  jasmineNodeOpts: {
    print: function() {}
  },
  onPrepare: function() {
    var KapReporter = require('karma-and-protractor-reporter').KapReporter;
    jasmine.getEnv().addReporter(new KapReporter({
      useColors: true,
      showTiming: true,
      style: 'dots',
      stackStyle: 'summary'
    }));
  }
};

Options

addSpacing

Type: Boolean default true

Set to true to add a new line between tests.

colors

Type: Object default

The following colors are used by default for more options refer to marak/colors.js documentation.

{
  passed: ['green', 'bold'],
  failed: ['red', 'bold'],
  pending: ['yellow', 'bold'],
  other: ['cyan', 'bold'],
  base: ['reset'],
  stack: ['red'],
  stackHighlight: ['red', 'bold']
}

failDot

Type: String default 'F'

If using 'dots' style, this character will be used for each failing test.

indent

Type: String default ' '

This can be changed to override the indentation size.

passDot

Type: String default '*'

If using 'dots' style, this character will be used for each passing test.

pendingDot

Type: String default 'P'

If using 'dots' style, this character will be used for each pending test.

showId

Type: Boolean default false

If set a test id will be displayed beside each test.

showPassed

Type: String default false

Show the description of each passing test. Not available with 'compact' style.

showPending

Type: Boolean default true

Show the description of each pending test. Not available with 'compact' style.

showFailed

Type: Boolean default true

Show the description of each failed test. Not available with 'compact' style.

showTiming

Type: Boolean default true

Show how long each test took to run.

stackStyle

Type: String default 'summary'

stacktraces can be highlighted or abbreviated to help you get to the failing code more quickly.

  • 'summary' less important info is removed from the stacktrace.
  • 'highlight' most important info is hightlighted in the stacktrace.
  • 'default' the stacktrace is not altered.
  • 'none' no stacktrace is shown.

style

Type: String default 'dots'

The overall display can be altered.

  • 'dots' same as normal but a character is displayed for each test runs.
  • 'compact' a more compact view of all the tests that have execute.
  • 'normal' each test renders its outcome. (see 'showPassed', 'showPending', 'showFailed')

useColors

Type: Boolean default true

Use colors in the output.

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago