mediawiki-extensions-Visual.../Gruntfile.js
Trevor Parscal d2dfb9ac4f Split oojs-ui from ve.ui
* Move and rename generic parts of ve.ui to OO.ui
* We now have a UI test suite because ve.Element (outside ve.ui)
  is now part of oojs-ui, so it needs a test suite.
* Added to the MW test run (just like we do for unicodejs).
* Updated csslint config (also added ve-mw and syntaxhighlight
  which were missing).

oojs-ui still depends on the TriggerRegistry in VE, this is addressed
in a follow-up commit.

Change-Id: Iec147155c1ddf20b73a4d15d87b8742207032312
2013-10-28 22:40:08 -07:00

63 lines
1.7 KiB
JavaScript

/*!
* Grunt file
*
* @package VisualEditor
*/
/*jshint node:true */
module.exports = function ( grunt ) {
var fs = require( 'fs' ),
exec = require( 'child_process' ).exec;
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-contrib-csslint' );
grunt.loadNpmTasks( 'grunt-contrib-qunit' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.initConfig( {
pkg: grunt.file.readJSON( 'package.json' ),
jshint: {
options: JSON.parse( grunt.file.read( '.jshintrc' )
.replace( /\/\*(?:(?!\*\/)[\s\S])*\*\//g, '' ).replace( /\/\/[^\n\r]*/g, '' ) ),
all: ['*.js', 'modules/**/*.js']
},
csslint: {
options: {
csslintrc: '.csslintrc'
},
all: 'modules/{oojs-ui,syntaxhighlight,ve,ve-mw}/**/*.css',
},
qunit: {
ve: 'modules/ve/test/index-phantomjs-tmp.html',
'oojs-ui': 'modules/oojs-ui/test/index.html'
},
watch: {
files: ['<%= jshint.all %>', '<%= csslint.all %>', '<%= qunit.all %>', '.{jshintrc,jshintignore,csslintrc}'],
tasks: ['test']
}
} );
grunt.registerTask( 'pre-qunit', function () {
var done = this.async();
grunt.file.setBase( __dirname + '/modules/ve/test' );
exec( 'php index.php > index-phantomjs-tmp.html', function ( err, stdout, stderr ) {
if ( err || stderr ) {
grunt.log.error( err || stderr );
done( false );
} else {
grunt.file.setBase( __dirname );
done( true );
}
} );
} );
grunt.event.on( 'qunit.done', function () {
fs.unlinkSync( __dirname + '/modules/ve/test/index-phantomjs-tmp.html' );
} );
grunt.registerTask( 'lint', ['jshint', 'csslint'] );
grunt.registerTask( 'unit', ['pre-qunit', 'qunit'] );
grunt.registerTask( 'test', ['lint', 'unit'] );
grunt.registerTask( 'default', 'test' );
};