Skip to content

Instantly share code, notes, and snippets.

@jpommerening
Created April 10, 2014 10:03
Show Gist options
  • Save jpommerening/10364033 to your computer and use it in GitHub Desktop.
Save jpommerening/10364033 to your computer and use it in GitHub Desktop.
grunt-karma PR #103
module.exports = function (grunt) {
function Explosion() {}
Explosion.prototype = new Error( 'Bam!' );
function initFramework( emitter ) {
emitter.on( 'browser_complete', function() {
throw new Explosion();
} );
}
initFramework.$inject = [ 'emitter' ];
grunt.initConfig( {
karma: {
options: {
plugins: [
require( 'karma-phantomjs-launcher' ),
{ 'framework:explode': [ 'factory', initFramework ] }
],
browsers: [ 'PhantomJS' ],
singleRun: true
},
unicorns: {
options: {
files: [ 'test.js' ]
}
},
explosions: {
options: {
files: [ 'test.js' ],
frameworks: [ 'explode' ]
}
}
}
} );
grunt.loadNpmTasks( 'grunt-karma' );
grunt.registerTask( 'default', [ 'karma:unicorns', 'karma:explosions' ] );
};
{
"name": "grunt-karma-pr-103",
"description": "Temporarily remove Grunt's uncaughtException listener",
"version": "0.0.0",
"dependencies": {
"grunt": "~0.4.4",
"grunt-karma": "~0.8.2",
"karma-phantomjs-launcher": "~0.1.4"
}
}
function mockedTest( karma ) {
karma.info({
total: 1,
specs: [ 'test' ]
});
karma.result({
description: 'This is a test',
id: 'test',
log: [],
skipped: false,
success: true,
suite: [],
time: 0
});
karma.complete({});
}
window.__karma__.start = function() {
mockedTest( window.__karma__ );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment