voxmedia/karma-mocha-reporter

Name: karma-mocha-reporter

Owner: Vox Media

Description: Karma reporter plugin with mocha style logging.

Forked from: litixsoft/karma-mocha-reporter

Created: 2016-08-10 03:45:48.0

Updated: 2016-08-10 03:45:49.0

Pushed: 2016-08-10 03:57:54.0

Homepage: null

Size: 1080

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

karma-mocha-reporter

Karma reporter plugin with mocha style logging.

NPM version Build Status david-dm david-dm

How does it look like

screenshot

Installation

The easiest way is to keep karma-mocha-reporter as a devDependency in your package.json.


evDependencies": {
"karma": "^1.0.0",
"karma-mocha-reporter": "^2.0.0"


You can simple do it by:

$ npm install karma-mocha-reporter --save-dev
Configuration
arma.conf.js
le.exports = function(config) {
nfig.set({
frameworks: ['jasmine'],

// reporters configuration
reporters: ['mocha']
;

Options
colors

Type: Object | Boolean

Let's you overwrite the default colors. Possible values are all colors and background colors from chalk.

Possible Values:

Value | Description | Default —— | ———– | ——- success | success messages | green info | info messages | grey warning | warn messages | yellow error | error messages | red

arma.conf.js
le.exports = function(config) {
nfig.set({
frameworks: ['jasmine'],

// reporters configuration
reporters: ['mocha'],

// reporter options
mochaReporter: {
  colors: {
    success: 'blue',
    info: 'bgGreen',
    warning: 'cyan',
    error: 'bgRed'
  },
  symbols: {
    success: '+',
    info: '#',
    warning: '!',
    error: 'x'
  }
}
;

To disable the colors please use the colors option in the karma config.

arma.conf.js
le.exports = function(config) {
nfig.set({
frameworks: ['jasmine'],

// reporters configuration
reporters: ['mocha'],

// disable colors
colors: false
;

symbols

Type: Object

Let's you overwrite the default symbols.

Possible Values:

Value | Description | Default —— | ———– | ——- success | success messages | ? info | info messages | ? warning | warn messages | ? error | error messages | ?

arma.conf.js
le.exports = function(config) {
nfig.set({
frameworks: ['jasmine'],

// reporters configuration
reporters: ['mocha'],

// reporter options
mochaReporter: {
  symbols: {
    success: '+',
    info: '#',
    warning: '!',
    error: 'x'
  }
}
;

output

Type: String

Possible Values:

Value | Description —— | ———– full (default) | all output is printed to the console autowatch | first run will have the full output and the next runs just output the summary and errors in mocha style minimal | only the summary and errors are printed to the console in mocha style noFailures | the failure details are not logged

arma.conf.js
le.exports = function(config) {
nfig.set({
frameworks: ['jasmine'],

// reporters configuration
reporters: ['mocha'],

// reporter options
mochaReporter: {
  output: 'autowatch'
}
;

showDiff

Type: String | Boolean

Shows a diff output. Is disabled by default. All credits to the contributors of mocha, since the diff logic is used from there and customized for this module.

screenshot

Currently only works with karma-mocha >= v0.2.2 Not supported for karma-jasmine since the additional properties needed to render the diff are not supported in jasmine yet.

Possible Values:

Value | Description —— | ———– true | prints each diff in its own line, same as 'unified' 'unified' | prints each diff in its own line 'inline' | prints diffs inline

arma.conf.js
le.exports = function(config) {
nfig.set({
frameworks: ['mocha', 'chai'],

// reporters configuration
reporters: ['mocha'],

// reporter options
mochaReporter: {
  showDiff: true
}
;

divider

Type: String

Default: 80 equals signs ('=')

The string to output between multiple test runs. Set to false or empty string to disable

arma.conf.js
le.exports = function(config) {
nfig.set({
frameworks: ['jasmine'],

// reporters configuration
reporters: ['mocha'],

// reporter options
mochaReporter: {
  divider: ''
}
;

ignoreSkipped

Type: Boolean

Possible Values:

When setting the ignoreSkipped flag to true, the reporter will ignore the skipped tests in the output and you will see only the tests that where really executed. The summary will still contain the number of skipped tests.

Contributing

In lieu of a formal styleguide take care to maintain the existing coding style. Lint and test your code using grunt.

You can preview your changes by running:

$ npm run demo
Author

Litixsoft GmbH

License

Copyright © 2013-2016 Litixsoft GmbH info@litixsoft.de Licensed under the MIT license.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included i all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.