2 module
.exports = function ( grunt
) {
3 grunt
.loadNpmTasks( 'grunt-contrib-copy' );
4 grunt
.loadNpmTasks( 'grunt-contrib-jshint' );
5 grunt
.loadNpmTasks( 'grunt-stylelint' );
6 grunt
.loadNpmTasks( 'grunt-contrib-watch' );
7 grunt
.loadNpmTasks( 'grunt-banana-checker' );
8 grunt
.loadNpmTasks( 'grunt-jscs' );
9 grunt
.loadNpmTasks( 'grunt-jsonlint' );
10 grunt
.loadNpmTasks( 'grunt-karma' );
12 var wgServer
= process
.env
.MW_SERVER
,
13 wgScriptPath
= process
.env
.MW_SCRIPT_PATH
,
16 karmaProxy
[ wgScriptPath
] = wgServer
+ wgScriptPath
;
32 '!{docs/js,extensions,node_modules,skins,vendor}/**'
37 disallowBlankTranslations
: false
39 core
: 'languages/i18n/',
40 api
: 'includes/api/i18n/',
41 installer
: 'includes/installer/i18n/'
47 src
: '{resources/src/*,mw-config/**}/*.{css,less}'
51 '.{stylelintrc,jscsrc,jshintignore,jshintrc}',
53 '!{docs,extensions,node_modules,skins,vendor}/**'
61 pattern
: wgServer
+ wgScriptPath
+ '/index.php?title=Special:JavaScriptTest/qunit/export',
67 frameworks
: [ 'qunit' ],
68 reporters
: [ 'progress' ],
71 // Some tests in extensions don't yield for more than the default 10s (T89075)
72 browserNoActivityTimeout
: 60 * 1000
75 browsers
: [ 'Chrome' ]
78 browsers
: [ 'Chrome', 'Firefox' ]
83 src
: 'resources/**/*',
84 dest
: 'docs/js/modules',
86 rename: function ( dest
, src
) {
87 return require( 'path' ).join( dest
, src
.replace( 'resources/', '' ) );
93 grunt
.registerTask( 'assert-mw-env', function () {
94 if ( !process
.env
.MW_SERVER
) {
95 grunt
.log
.error( 'Environment variable MW_SERVER must be set.\n' +
96 'Set this like $wgServer, e.g. "http://localhost"'
99 if ( !process
.env
.MW_SCRIPT_PATH
) {
100 grunt
.log
.error( 'Environment variable MW_SCRIPT_PATH must be set.\n' +
101 'Set this like $wgScriptPath, e.g. "/w"' );
103 return !!( process
.env
.MW_SERVER
&& process
.env
.MW_SCRIPT_PATH
);
106 grunt
.registerTask( 'lint', [ 'jshint', 'jscs', 'jsonlint', 'banana', 'stylelint' ] );
107 grunt
.registerTask( 'qunit', [ 'assert-mw-env', 'karma:main' ] );
109 grunt
.registerTask( 'test', [ 'lint' ] );
110 grunt
.registerTask( 'default', 'test' );