Giter VIP home page Giter VIP logo

karma-tap-pretty-reporter's Introduction

karma-tap-pretty-reporter

npm version npm downloads Build Status Windows Tests Donate

a Karma reporter plugin for report and prettify TAP test results

Installation

npm

npm install karma karma-tap karma-tap-pretty-reporter --save-dev

[optional] install a prettify package. See below supported prettifiers

npm install faucet --save-dev

Usage

Add karma.conf.js file to project.

Example:

// karma.conf.js
module.exports = function(config) {
  config.set({
    reporters: ['tap-pretty'],

    tapReporter: {
      prettify: require('faucet'), // default 'standard TAP' output
      separator: '****************************'
    },
  });
};

Using separator

On Karma autoWatch mode maybe we need separate test run cycles output. Create a separator string for this purpose.

In order of not pollute output, separator will be shown only if LogLevel is different of LOG_INFO nor LOG_DEBUG

Report to a file

Optionally you can save report to a file and turn off output to the console.

// karma.conf.js

reporters: ['tap-pretty'],

tapReporter: {
  outputFile: './test.out.tap',
  disableStdout: true            // default 'false'
},

Supported prettifiers

Use Cases

Show only 'failed' test

Install tap-difflet package

npm install tap-difflet --save-dev

Add settings to tapReporter on karma.conf.js

tapReporter: {
      // outputFile: './unit.tap',
      prettify: function() { return require('tap-difflet')({ pessimistic: true }); },
      separator: '****************************',
    },

Example

Credits

author

contributors

Contributing

  • Documentation improvement
  • Feel free to send any PR

License

ISC

karma-tap-pretty-reporter's People

Contributors

bysabi avatar infernalmaster avatar luwes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

karma-tap-pretty-reporter's Issues

Error: stream.push() after EOF

I have karma configured with webpack and autoWatch and disableStdout: false; every time I make the first change to re-run the tests for the first time, the base reporter reports calls specFailure, leading to an attempted push to the Readable stream.

Stack trace:

PhantomJS 2.1.1 (Linux 0.0.0) LOG: 'TAP version 13'
PhantomJS 2.1.1 (Linux 0.0.0) LOG: '# TimeSlider is a React component'
PhantomJS 2.1.1 (Linux 0.0.0) LOG: 'not ok 1 should be equal'
PhantomJS 2.1.1 (Linux 0.0.0) LOG: '  ---'
PhantomJS 2.1.1 (Linux 0.0.0) LOG: '    operator: equal'
PhantomJS 2.1.1 (Linux 0.0.0) LOG: '    expected: true'
PhantomJS 2.1.1 (Linux 0.0.0) LOG: '    actual:   false'
PhantomJS 2.1.1 (Linux 0.0.0) LOG: '  ...'
PhantomJS 2.1.1 (Linux 0.0.0) LOG: 'not ok 2 plan != count'
PhantomJS 2.1.1 (Linux 0.0.0) LOG: '  ---'
PhantomJS 2.1.1 (Linux 0.0.0) LOG: '    operator: fail'
PhantomJS 2.1.1 (Linux 0.0.0) LOG: '    expected: 2'
PhantomJS 2.1.1 (Linux 0.0.0) LOG: '    actual:   1'
PhantomJS 2.1.1 (Linux 0.0.0) LOG: '  ...'
PhantomJS 2.1.1 (Linux 0.0.0) LOG: ''
PhantomJS 2.1.1 (Linux 0.0.0) LOG: '1..2'
PhantomJS 2.1.1 (Linux 0.0.0) LOG: '# tests 2'
PhantomJS 2.1.1 (Linux 0.0.0) LOG: '# pass  0'

Missing error handler on `socket`.
Error: stream.push() after EOF
    at readableAddChunk (_stream_readable.js:157:17)
    at Readable.push (_stream_readable.js:135:10)
    at write (/home/sunnyg/gitdev/descarteslabs/widgets/node_modules/karma-tap-pretty-reporter/index.js:30:11)
    at writeSuite (/home/sunnyg/gitdev/descarteslabs/widgets/node_modules/karma-tap-pretty-reporter/index.js:37:7)
    at specFailure (/home/sunnyg/gitdev/descarteslabs/widgets/node_modules/karma-tap-pretty-reporter/index.js:76:5)
    at onSpecComplete (/home/sunnyg/gitdev/descarteslabs/widgets/node_modules/karma/lib/reporters/base.js:85:12)
    at .<anonymous> (/home/sunnyg/gitdev/descarteslabs/widgets/node_modules/karma/lib/events.js:13:22)
    at emitTwo (events.js:106:13)
    at emit (events.js:191:7)
    at onResult (/home/sunnyg/gitdev/descarteslabs/widgets/node_modules/karma/lib/browser.js:217:13)
    at Socket.<anonymous> (/home/sunnyg/gitdev/descarteslabs/widgets/node_modules/karma/lib/events.js:13:22)
    at emitOne (events.js:101:20)
    at Socket.emit (events.js:188:7)
    at Socket.onevent (/home/sunnyg/gitdev/descarteslabs/widgets/node_modules/karma/node_modules/socket.io/lib/socket.js:335:8)
    at Socket.onpacket (/home/sunnyg/gitdev/descarteslabs/widgets/node_modules/karma/node_modules/socket.io/lib/socket.js:295:12)
    at Client.ondecoded (/home/sunnyg/gitdev/descarteslabs/widgets/node_modules/karma/node_modules/socket.io/lib/client.js:193:14)
16 09 2016 02:29:32.772:DEBUG [PhantomJS 2.1.1 (Linux 0.0.0)]: Disconnected during run, waiting 2000ms for reconnecting.
16 09 2016 02:29:34.774:WARN [PhantomJS 2.1.1 (Linux 0.0.0)]: Disconnected (1 times)
PhantomJS 2.1.1 (Linux 0.0.0) ERROR
  Disconnectedundefined

and then right after, the same error from Karma:

16 09 2016 02:29:34.780:ERROR [karma]: Error: stream.push() after EOF
    at readableAddChunk (_stream_readable.js:157:17)
    at Readable.push (_stream_readable.js:135:10)
    at write (/home/sunnyg/gitdev/descarteslabs/widgets/node_modules/karma-tap-pretty-reporter/index.js:30:11)
    at onRunComplete (/home/sunnyg/gitdev/descarteslabs/widgets/node_modules/karma-tap-pretty-reporter/index.js:99:5)
    at .<anonymous> (/home/sunnyg/gitdev/descarteslabs/widgets/node_modules/karma/lib/events.js:13:22)
    at emitTwo (events.js:111:20)
    at emit (events.js:191:7)
    at Timeout._onTimeout (/home/sunnyg/gitdev/descarteslabs/widgets/node_modules/karma/lib/executor.js:51:17)
    at tryOnTimeout (timers.js:232:11)
    at Timer.listOnTimeout (timers.js:202:5)
16 09 2016 02:29:34.786:DEBUG [launcher]: Disconnecting all browsers
16 09 2016 02:29:34.819:DEBUG [launcher]: Process PhantomJS exited with code 0
16 09 2016 02:29:34.820:DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-65530249
16 09 2016 02:29:34.825:DEBUG [launcher]: Finished all browsers

Missing path to file from sourcemaps

My errors come up with: "Name of error at undefined". I assume undefined should be a file path. But I can't get it to work.

I use webpack and karma-sourcemap-loader. Anything special I need to configure?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.