Tizen 2.1 base
[platform/framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.2.0 / node_modules / grunt-junit / tasks / grunt-junit.js
1 /*
2  * grunt-junit
3  * https://github.com/johnbender/grunt-junit
4  *
5  * Copyright (c) 2012 John Bender
6  * Licensed under the MIT license.
7  */
8
9 var child_process = require( 'child_process' ),
10     semver = require( 'semver' );
11
12 module.exports = function( grunt ) {
13         grunt.registerTask( 'junit:env', function() {
14                 var done = this.async();
15
16                 if( !process.env.JUNIT_OUTPUT ){
17                         grunt.fail.fatal( "The junit grunt plugin requires a directory be set " +
18                                                                                                 "for junit output in the env variable JUNIT_OUTPUT" );
19                 }
20
21                 child_process.exec( "phantomjs --version", function(err, stdout, stderr) {
22                         if( semver.lt( stdout, '1.5.0' ) ){
23                                 grunt.fail.fatal( "The junit grunt plugin requires a version of phantomjs " +
24                                                                                                         "greater than or equal to 1.5.0" );
25
26                         }
27
28                         done();
29                 });
30         });
31
32         grunt.registerTask( 'junit', 'junit:env qunit' );
33 };