2 module
.exports = function ( grunt
) {
3 grunt
.loadNpmTasks( 'grunt-contrib-copy' );
4 grunt
.loadNpmTasks( 'grunt-contrib-jshint' );
5 grunt
.loadNpmTasks( 'grunt-contrib-watch' );
6 grunt
.loadNpmTasks( 'grunt-banana-checker' );
7 grunt
.loadNpmTasks( 'grunt-jscs' );
8 grunt
.loadNpmTasks( 'grunt-jsonlint' );
9 grunt
.loadNpmTasks( 'grunt-karma' );
11 var wgServer
= process
.env
.MW_SERVER
,
12 wgScriptPath
= process
.env
.MW_SCRIPT_PATH
,
15 karmaProxy
[ wgScriptPath
] = wgServer
+ wgScriptPath
;
31 '!{docs/js,extensions,node_modules,skins,vendor}/**'
36 disallowBlankTranslations
: false
38 core
: 'languages/i18n/',
39 api
: 'includes/api/i18n/',
40 installer
: 'includes/installer/i18n/'
46 '!{docs,extensions,node_modules,skins,vendor}/**'
54 pattern
: wgServer
+ wgScriptPath
+ '/index.php?title=Special:JavaScriptTest/qunit/export',
60 frameworks
: [ 'qunit' ],
61 reporters
: [ 'progress' ],
64 // Some tests in extensions don't yield for more than the default 10s (T89075)
65 browserNoActivityTimeout
: 60 * 1000
68 browsers
: [ 'Chrome' ]
71 browsers
: [ 'Chrome', 'Firefox' ]
76 src
: 'resources/**/*',
77 dest
: 'docs/js/modules',
79 rename: function ( dest
, src
) {
80 return require( 'path' ).join( dest
, src
.replace( 'resources/', '' ) );
86 grunt
.registerTask( 'assert-mw-env', function () {
87 if ( !process
.env
.MW_SERVER
) {
88 grunt
.log
.error( 'Environment variable MW_SERVER must be set.\n' +
89 'Set this like $wgServer, e.g. "http://localhost"'
92 if ( !process
.env
.MW_SCRIPT_PATH
) {
93 grunt
.log
.error( 'Environment variable MW_SCRIPT_PATH must be set.\n' +
94 'Set this like $wgScriptPath, e.g. "/w"' );
96 return !!( process
.env
.MW_SERVER
&& process
.env
.MW_SCRIPT_PATH
);
99 grunt
.registerTask( 'lint', [ 'jshint', 'jscs', 'jsonlint', 'banana' ] );
100 grunt
.registerTask( 'qunit', [ 'assert-mw-env', 'karma:main' ] );
102 grunt
.registerTask( 'test', [ 'lint' ] );
103 grunt
.registerTask( 'default', 'test' );