Giter Site home page Giter Site logo

karma-nyan-reporter's Introduction

npm version Build Status Coverage Status Code Climate

karma-nyan-reporter

Nyan Cat style reporter originally cobbled together from the Mocha version

Karma Nyan Cat Reporter for Karma

Installation

Installation is simple using npm, just run the following command:

npm install --save-dev karma-nyan-reporter

Since this follows Karma's plugin naming convention, that's all there is to it!

Now, run your tests and enjoy:

karma start path/to/karma.conf.js --reporters nyan

Error and Logging Output

Here is a screenshot of the error and logging output. The errors are displayed hierarchically based on the test suite and nesting level. console.log() messages are output at the bottom (in blue) below the test summary and grouped by browser.

Karma Nyan Cat Reporter Error Output

Options

If you want to suppress the stack trace at the end of the test run you can use the suppressErrorReport option.

// karma.conf.js
module.exports = function(config) {
  config.set({
    // normal config stuffs

    reporters: ['nyan'],

    // reporter options
    nyanReporter: {
      // suppress the error report at the end of the test run
      suppressErrorReport: true, // default is false

      // suppress the red background on errors in the error
      // report at the end of the test run
      suppressErrorHighlighting: true, // default is false

      // increase the number of rainbow lines displayed
      // enforced min = 4, enforced max = terminal height - 1
      numberOfRainbowLines: 100, // default is 4

      // only render the graphic after all tests have finished.
      // This is ideal for using this reporter in a continuous
      // integration environment.
      renderOnRunCompleteOnly: true // default is false
    }
  });
};

In this release

  • Fix for issue #23 - Total tests count is different from other reporters

karma-nyan-reporter's People

Contributors

ashwell avatar atomicframeworks avatar dgarlitt avatar idiotwu avatar koba04 avatar lpww avatar thammin avatar yhnavein avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

karma-nyan-reporter's Issues

Nyan reporter output is strange when there is uncaught exception outside tests

When there is an error somewhere outside tests nyan reporter is behaving weird. When I run tests using standard dots reporter I see error and logs:

screen shot 2015-10-05 at 12 38 36 pm

And I can say that something wrong and even see the exception.
But when I try nyan reporter I see this:

screen shot 2015-10-05 at 12 39 38 pm

No logs, no errors, cursor in the strange place.
And if I save a couple of times the output gets totally corrupted:

screen shot 2015-10-05 at 12 40 09 pm

Issue with display when run through 'Task Runner Explorer' in VS

When being run through Visual Studio's Task Runner Explorer for Node the output appears broken. Instead of moving from left to right, each 'step' is re-rendered on the line below.

Running the same through CMD or GitBash and it renders correctly.

Task runner:
image

GitBash:
image

This is using: V0.2.4

Karma-nyan-reporter works strange when node upgraded to 0.12 from 0.10

Hi,

After upgrading node from v0.10 to v0.12.3 I have a problem with reporting in karma. Here is example what's wrong:

โžœ webapp >$ karma start test/karma.conf.js --single-run --browsers PhantomJS --reporters nyan

 46  -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_,------,
 0   -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_|   /\_/\ 
 0   -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_|__( ^ .^) 
     -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_%  

When I run the same command but from npm test alias I'll see something even more bizarre:

PhantomJS 1.9.8 (Linux): Executed 40 of 60 SUCCESS (0 secs / 0.035 secs)
 40  -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_,------,
 0   -_-_-_-_-_-_-_-_% 

And just to compare with any different reporter:
โžœ webapp >$ karma start test/karma.conf.js --single-run --browsers PhantomJS --reporters dots

............................................................
PhantomJS 1.9.8 (Linux): Executed 60 of 60 SUCCESS (0.056 secs / 0.053 secs)

Everything is fine in dots reporter

Some info:
elementaryOS 0.3
node -v 0.12.3
npm -v 2.10.0
package.json devDependencies:

    "karma": "~0.12.32", 
    "grunt": "~0.4.1",
    "karma-chrome-launcher": "0.1.4",
    "karma-jasmine": "~0.1.5",
    "karma-phantomjs-launcher": "0.1.4",
    "grunt-karma": "~0.10"

Cheers,

Tests fail to run (could be mis-config on my end)

I installed karma-nyan-reporter and I'm using Karma v0.12.31 with Jasmine and I do

karma start --reporters nyan

and all I have in my karma.conf.js file relating to your formatter is:

reporters: ['nyan'],

and it starts fine, but then when I open another terminal and do:

karma run

on the "run" window I get:

[2015-01-15 08:31:28.546] [DEBUG] config - Loading config /Users/Thien/GitHub/test/www/karma.conf.js

/Users/Thien/GitHub/test/node_modules/karma/lib/runner.js:59
      throw e;
            ^
Error: socket hang up
    at createHangUpError (http.js:1477:15)
    at Socket.socketOnEnd [as onend] (http.js:1573:23)
    at Socket.g (events.js:180:16)
    at Socket.emit (events.js:117:20)
    at _stream_readable.js:944:16
    at process._tickCallback (node.js:442:13)

and on the "start" window I get:

ERROR [karma]: [TypeError: Cannot call method 'push' of undefined]
TypeError: Cannot call method 'push' of undefined
    at /Users/Thien/GitHub/test/node_modules/karma/lib/reporters/multi.js:8:25
    at Array.forEach (native)
    at addAdapter (/Users/Thien/GitHub/test/node_modules/karma/lib/reporters/multi.js:7:15)
    at null.<anonymous> (/Users/Thien/GitHub/test/node_modules/karma/lib/middleware/runner.js:40:18)
    at g (events.js:180:16)
    at emit (events.js:117:20)
    at schedule (/Users/Thien/GitHub/test/node_modules/karma/lib/executor.js:25:15)
    at /Users/Thien/GitHub/test/node_modules/karma/lib/middleware/runner.js:81:20
    at /Users/Thien/GitHub/test/node_modules/karma/node_modules/connect/node_modules/body-parser/lib/read.js:100:5
    at IncomingMessage.onEnd (/Users/Thien/GitHub/test/node_modules/karma/node_modules/connect/node_modules/body-parser/node_modules/raw-body/index.js:136:7)

Is there something in my karma.conf.js or a dependecy that I am missing? I can run my rudimentary tests without the reporter and it works, and I've tried another reporter and it works as well. I'm new to Karma/Jasmine, so I assume it's something on my end that I am doing wrong/missing. Any help would be appreciated, thanks.

Make Nyan Cat Fly During Browser Capture

First off, you are truly doing God's work with this plug-in. Thanks for all the work that went into it.

I do have a feature request though. I'm currently running Karma tests against browsers captured via Sauce Labs. For each test I run, it takes about 15-75 seconds for the browser instance to be created and then captured. This delay would be much more tolerable if I could watch Nyan Cat fly through the night's sky as the capturing proceeds.

Currently, he doesn't start flying until the test actually begins executing. Since my tests normally take only a second or two to run, I end up barely seeing the animation at all. I only have 1 test out of 12 that actually runs long enough to see it.

Would it be possible to change the default or add a setting that one can opt into so that the animation kicks off much earlier/immediately in the test run?

"[object Object]" is printed instead of runtime errors

If the tests fail with a severe error , like requiring a non-existing script, or by a syntax error in a script, the error is not printed correctly. It is an object and after applying toString to it, even the cat cannot improve the useless output ;-)

HeadlessChrome 0.0.0 (Linux 0.0.0)
[object Object]

For example, if JSON.stringify were applied to it to get the full object printed, it would look like this:

HeadlessChrome 0.0.0 (Linux 0.0.0) ERROR
{
  "message": "Uncaught Error: 'expect' was used when there was no current spec,...",
  "str": "Uncaught Error: 'expect' was used when there was no current spec, ..."
}

As long as the object structure is known, if object.message is defined, the message can be printed right away:

HeadlessChrome 0.0.0 (Linux 0.0.0) ERROR
Error: 'expect' was used when there was no current spec,...

Issue with display in Windows

This reporter works great. However, there's a minor display glitch with the rainbow in Windows. It's not displaying the pleasing Nyan Cat rainbow that you nice folks running on a Mac get. ๐ŸŒˆ

We want some Nyan Cat love, too! ๐Ÿ‘

Here's what we see:

capture

Suppress printing the console log content after the test failures

Testing frameworks like Backbone, which do not litter the console with logs gives conscious and legible output - the summary first and then the list of failures, if there were any. However, when dealing with legacy code, which uses console.log, many "useless" log lines may follow the failure summary. It makes looking up the failures more difficult by scrolling up the console to find the failures.

How about introducing a new option like suppressBrowserLogs to suppress the log printing?

Reporter omits WebPack line numbers from stack trace

When using the Nyan reporter with WebPack + Karma the stack trace does not show the webpack line number. With the dots/progress reporters I see:

ReferenceError: Can't find variable: chrome
at /path/to/app/test/components/button-container-test.js:310:0 <-webpack:///src/lib/browser-events.js:55:4

With Nyan I see:

ReferenceError: Can't find variable: chrome
at http://localhost:9876/base/test/components/button-container-test.js?7041e150
b46e58c658019f97671c3f4701c5319b:310

Notice the missing <-webpack:///src/lib/browser-events.js:55:4 which directs me to the actual location of the error with webpack.

I've followed this guide to setup WebPack with Karma: http://nicolasgallagher.com/how-to-test-react-components-karma-webpack/

Basically I have sourcemaps turned on and am using karma-soucemap-loader.

Let me know if I can provide more info to help fix.

hiding console.logs

Using the nyan-reporter, when you put a console.log inside your tests, they didn't show.

Show total test count

It would be nice if the numbers on the left showed how many total tests there are so I get some idea of the progress of the test suite. Any way we could include this?

Can not load reporter "nyan", it is not registered!

Is this repository/reporter still maintained? It appears to be completely broken:

As per the instructions:
npm install --save-dev karma-nyan-ext-reporter
then in karma.conf.js
reporters: ['nyan'],

Resulting error:
Can not load reporter "nyan", it is not registered!

Adding require('karma-nyan-ext-reporter'), to plugins in karma.conf.js doesn't help.

Error log numbers don't reset when tests are re-run

Unsure if this is intended behavior or not:

For example:

  • two tests fail with 1) and 2) displaying with their associated errors.
  • you edit a file, save, triggering the tests to run again
  • when any tests fail (let's say the same two test fail again)
  • the numbers accompanying the errors in the error report will say 3) and 4)
  • when tests run again, if three tests fail, 5), 6), and 7) will show

The only way to reset the counter is to exit the testing Ctrl + C and restart npm test

Expected behavior:

  • Tests' error logged ordered list will always start at 1)

I can happily submit a PR for this; it takes only a few lines of code to fix

Test error desplays even after fixed

First off, thanks for the awesome plugin :)

I'm noticing some strange behavior when running a test. When I fix a broken test I still see the previous error below the passing test suite:

Is there a configuration step I might be missing or is this a bug? Thanks for any pointers.

Template parse errors don't appear in report (Angular 2 project)

In an Angular 2 project, when running tests with progress reporter, errors such as this:

Template parse errors:
The pipe `capitalizeFirstLetter` could not be found ...

do not show up in the nyan reporter.

I have a fix for this; please see #27

The issue occurs here:
DataStore.prototype.saveResultToSuite = function(suite, browser, result) {
in the result object. Specifically result.log is an array of strings (errors) which typically contains one long string that is later parsed. The Template parse errors end up as a second element of this array. And currently, only the first element is saved: brwsr.errors = result.log[0].split('\n');

My solution is to include a conditional to check if there is more than one element in the array, and if so, concatenate them to the first element so that all errors get displayed correctly in the log.

Total tests count is different from other reporters

When I run tests in multiple browsers, it seems nyan reporter will only count total tests from one test suite:

wx20170104-150939

wx20170104-150956

Notice that the total count and passed count stay the same. And if I use the mocha-reporter, I will actually get a total count at 64:

wx20170104-151149

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.