Created
April 10, 2014 10:03
-
-
Save jpommerening/10364033 to your computer and use it in GitHub Desktop.
grunt-karma PR #103
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' ] ); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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