karma-custom

1.1.9 • Public • Published

karma-custom

version npm version

Build Status Coverage Status

Dependency Status devDependency Status

Home Page

A karma adapter to run custom and framework free test suites

Purpose

  • Testing your own test framework (It's why I created this pluggin first)
  • Testing in browser very tiny modules which may not require a formal BDD method but still need to be tested (Cucumber, Jasmine, or others are maybe too much to test a simple addTwoNumbers function...)

Install

npm install karma-custom

How to use

Karma

Add 'custom' to the list of available frameworks in you karma.conf.js

//in your main-test-file.js
 
window.karmaCustomEnv = {};
window.karmaCustomEnv.execute = function(karma, window) {
    //use the node assert module (via browserify)
    var assert = require('assert');
 
    //You have access to the karma framework API
    console.log("Test suite started");
 
    try{
        //do your custom test here
        assert(true);
 
        karma.result({success: true})
 
    }catch(err){
        karma.result({
            success: false,
            suite: [],
            log: [err.message]
        });
    }
 
    karma.complete({});
};
 

Package Sidebar

Install

npm i karma-custom

Weekly Downloads

22

Version

1.1.9

License

MIT

Last publish

Collaborators

  • alexistessier