npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

karma-code-reporter

v0.1.1

Published

A Karma failed test examples creator module/plugin

Downloads

12

Readme

karma-code-reporter

NPM Version NPM Downloads Node.js Version Build Status Test Coverage

Prepares a test report which each failed case has it's own report and inline test case. I tested this with grunt + karma + jasmine configuration and I don't know it works on other test runners like mocha etc. It's open for collaboration.

Screenshots

Spec File Preview Index File Preview

Spec File Preview Spec File Preview

Installation

There are two installation options:

  1. Install using npm install command:
$ npm install karma-code-reporter --save-dev
  1. Add karma-code-reporter as a devDependency inside your package.json file
{
    "devDependencies": {
        "karma-code-reporter": "~0.1.0"
    }
}

Options

* required

outputPath*

(string) Defines the path that the output files will be created at. The folder will contain an index.html file which contains a list for each failed test, and the spec*.html files which contain the live versions of failed tests and the related code portion.

 [output folder]
 |--> index.html
 |--> spec1.html
 |--> spec2.html
 .

testFiles*

(array) The test files which will be ignored during html generation. This is needed because we don't want any other test cases to interfere with the failing spec.

cssFiles

(array) The extra css files which you want to include in the failed spec HTML files.

jsFiles

(array) The extra javascript files which you want to include int the failed spec HTML files.

Configuration

If you use a karma.conf.js file to define karma configuration, you can add this plugin's configuration like this:

// karma.conf.js
module.exports = function(config) {
  config.set({
    reporters: ['code'],
    codeReporter: {
        outputPath: 'tests/output/code',
        testFiles: ['tests/*.test.js'],
        cssFiles: ['build/css/style.min.css'],
        jsFiles: ['build/js/script.min.js']
    }
  });
};

Or if you are using Gruntfile.js to configure karma, you can use it like this:

module.exports = function (grunt) {
    // Project configuration.
    grunt.initConfig({
        karma: {
            dist: {
                options: {
                    files: [],
                    basePath: '',
                    frameworks: ['jasmine'],
                    reporters: ['progress', 'code'],
                    port: 9876,
                    colors: true,
                    browsers: ['PhantomJS'],
                    singleRun: true,
                    codeReporter: {
                        outputPath: 'tests/output/code',
                        testFiles: ['tests/*.test.js'],
                        cssFiles: ['build/css/caleran.min.css']
                    }
                }
            }
        }
    });

Contributing

In lieu of a formal styleguide take care to maintain the existing coding style.

Release History

  • 0.0.1 initial release

  • 0.0.2 added screenshots to README, fixed wrong version number in Installation section

  • 0.0.3 fixed bound calculation, added report visibility hidden until tests are completed

  • 0.0.4 added responsive styles

  • 0.0.5 split regexes for correct quote type handling

  • 0.0.6 removed 'UserContext' from log.stack parsing regex

  • 0.0.7 improved case surroundings detection (describe, beforeEach, afterEach)

  • 0.0.8 fixed source filename and line number parsing from log reports, updated lodash

  • 0.0.9 lodash security fix reported by dependabot

  • 0.0.10 previous version bump fixes, not so important

  • 0.1.0 - added more source line definitions such as "@file?id:line:pos" and " at Anonymous function (file?id:line:pos) for parsing, - added folder separation by browser type, - fixed some exceptions

  • 0.1.1 - fixed index file title and path mismatch

Author

Taha PAKSU

License

MIT