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
;
18 pkg
: grunt
.file
.readJSON( 'package.json' ),
25 '{includes,languages,resources,tests}/**/*.js'
31 // Auto-generated file with JSON (double quotes)
32 '!tests/qunit/data/mediawiki.jqueryMsg.data.js',
33 // Skip functions are stored as script files but wrapped in a function when
34 // executed. node-jscs trips on the would-be "Illegal return statement".
35 '!resources/src/*-skip.js'
37 // Exclude all files ignored by jshint
38 ].concat( grunt
.file
.read( '.jshintignore' ).split( '\n' ).reduce( function ( patterns
, pattern
) {
39 // Filter out empty lines
40 if ( pattern
.length
&& pattern
[0] !== '#' ) {
41 patterns
.push( '!' + pattern
);
49 '{languages,maintenance,resources}/**/*.json',
54 core
: 'languages/i18n/',
55 api
: 'includes/api/i18n/',
56 installer
: 'includes/installer/i18n/'
61 '<%= jsonlint.all %>',
71 pattern
: wgServer
+ wgScriptPath
+ '/index.php?title=Special:JavaScriptTest/qunit/export',
76 frameworks
: [ 'qunit' ],
77 reporters
: [ 'dots' ],
82 browsers
: [ 'Chrome' ]
85 browsers
: [ 'Chrome', 'Firefox' ]
90 src
: 'resources/**/*',
91 dest
: 'docs/js/modules',
93 rename: function ( dest
, src
) {
94 return require( 'path' ).join( dest
, src
.replace( 'resources/', '' ) );
100 grunt
.registerTask( 'lint', ['jshint', 'jscs', 'jsonlint', 'banana'] );
101 grunt
.registerTask( 'qunit', 'karma:main' );
103 grunt
.registerTask( 'test', ['lint'] );
104 grunt
.registerTask( 'default', 'test' );