3 module.exports = function ( grunt ) {
5 var wgServer = process.env.MW_SERVER,
6 wgScriptPath = process.env.MW_SCRIPT_PATH,
9 grunt.loadNpmTasks( 'grunt-banana-checker' );
10 grunt.loadNpmTasks( 'grunt-contrib-copy' );
11 grunt.loadNpmTasks( 'grunt-contrib-watch' );
12 grunt.loadNpmTasks( 'grunt-eslint' );
13 grunt.loadNpmTasks( 'grunt-jsonlint' );
14 grunt.loadNpmTasks( 'grunt-karma' );
15 grunt.loadNpmTasks( 'grunt-stylelint' );
17 karmaProxy[ wgScriptPath ] = {
18 target: wgServer + wgScriptPath,
30 '!resources/src/jquery.tipsy/**',
31 '!resources/src/jquery/jquery.farbtastic.js',
32 '!resources/src/mediawiki.libs/**',
34 // Explicitly say "**/*.js" here in case of symlinks
35 '!extensions/**/*.js',
37 // Skip functions aren't even parseable
38 '!resources/src/dom-level2-skip.js',
39 '!resources/src/es5-skip.js',
40 '!resources/src/mediawiki.hidpi-skip.js'
46 '!{docs/js,extensions,node_modules,skins,vendor}/**'
51 disallowBlankTranslations: false
53 core: 'languages/i18n/',
54 api: 'includes/api/i18n/',
55 installer: 'includes/installer/i18n/'
61 src: '{resources/src/*,mw-config/**}/*.{css,less}'
65 '.{stylelintrc,eslintrc.json}',
67 '!{docs,extensions,node_modules,skins,vendor}/**'
75 pattern: wgServer + wgScriptPath + '/index.php?title=Special:JavaScriptTest/qunit/export',
81 frameworks: [ 'qunit' ],
82 reporters: [ 'progress' ],
85 // Some tests in extensions don't yield for more than the default 10s (T89075)
86 browserNoActivityTimeout: 60 * 1000
89 browsers: [ 'Chrome' ]
92 browsers: [ 'Chromium' ]
95 browsers: [ 'Chrome', 'Firefox' ]
100 src: 'resources/**/*',
101 dest: 'docs/js/modules',
103 rename: function ( dest, src ) {
104 return require( 'path' ).join( dest, src.replace( 'resources/', '' ) );
110 grunt.registerTask( 'assert-mw-env', function () {
111 if ( !process.env.MW_SERVER ) {
112 grunt.log.error( 'Environment variable MW_SERVER must be set.\n' +
113 'Set this like $wgServer, e.g. "http://localhost"'
116 if ( !process.env.MW_SCRIPT_PATH ) {
117 grunt.log.error( 'Environment variable MW_SCRIPT_PATH must be set.\n' +
118 'Set this like $wgScriptPath, e.g. "/w"' );
120 return !!( process.env.MW_SERVER && process.env.MW_SCRIPT_PATH );
123 grunt.registerTask( 'lint', [ 'eslint', 'banana', 'stylelint' ] );
124 grunt.registerTask( 'qunit', [ 'assert-mw-env', 'karma:main' ] );
126 grunt.registerTask( 'test', [ 'lint' ] );
127 grunt.registerTask( 'default', 'test' );