X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=Gruntfile.js;h=573db69afb15a591d42bff5cd4e354562b8eb3df;hb=a26ea0bf8283c4fd9ecff990bef9bf2b63ec0d26;hp=4481e392a17ad8ccb4d4f4ce9cf50a9ac2e99dc7;hpb=cbe0728551b073f58ce2c5c1a34a2211ee037097;p=lhc%2Fweb%2Fwiklou.git diff --git a/Gruntfile.js b/Gruntfile.js index 4481e392a1..573db69afb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,5 +1,6 @@ /*jshint node:true */ module.exports = function ( grunt ) { + grunt.loadNpmTasks( 'grunt-contrib-copy' ); grunt.loadNpmTasks( 'grunt-contrib-jshint' ); grunt.loadNpmTasks( 'grunt-contrib-watch' ); grunt.loadNpmTasks( 'grunt-banana-checker' ); @@ -21,7 +22,7 @@ module.exports = function ( grunt ) { }, all: [ '*.js', - '{includes,languages,resources,skins,tests}/**/*.js' + '{includes,languages,resources,tests}/**/*.js' ] }, jscs: { @@ -75,7 +76,9 @@ module.exports = function ( grunt ) { frameworks: [ 'qunit' ], reporters: [ 'dots' ], singleRun: true, - autoWatch: false + autoWatch: false, + // Some tests in extensions don't yield for more than the default 10s (T89075) + browserNoActivityTimeout: 60 * 1000 }, main: { browsers: [ 'Chrome' ] @@ -83,11 +86,34 @@ module.exports = function ( grunt ) { more: { browsers: [ 'Chrome', 'Firefox' ] } + }, + copy: { + jsduck: { + src: 'resources/**/*', + dest: 'docs/js/modules', + expand: true, + rename: function ( dest, src ) { + return require( 'path' ).join( dest, src.replace( 'resources/', '' ) ); + } + } + } + } ); + + grunt.registerTask( 'assert-mw-env', function () { + if ( !process.env.MW_SERVER ) { + grunt.log.error( 'Environment variable MW_SERVER must be set.\n' + + 'Set this like $wgServer, e.g. "http://localhost"' + ); + } + if ( !process.env.MW_SCRIPT_PATH ) { + grunt.log.error( 'Environment variable MW_SCRIPT_PATH must be set.\n' + + 'Set this like $wgScriptPath, e.g. "/w"'); } + return !!( process.env.MW_SERVER && process.env.MW_SCRIPT_PATH ); } ); grunt.registerTask( 'lint', ['jshint', 'jscs', 'jsonlint', 'banana'] ); - grunt.registerTask( 'qunit', 'karma:main' ); + grunt.registerTask( 'qunit', [ 'assert-mw-env', 'karma:main' ] ); grunt.registerTask( 'test', ['lint'] ); grunt.registerTask( 'default', 'test' );