2016-11-08 15:59:22 +00:00
|
|
|
// jscs:disable jsDoc
|
2015-06-20 05:09:03 +00:00
|
|
|
/*jshint node:true */
|
|
|
|
module.exports = function ( grunt ) {
|
2016-11-08 19:42:21 +00:00
|
|
|
var QUNIT_URL_BASE = 'http://localhost:8080/wiki/Special:JavaScriptTest/qunit/plain';
|
2016-11-08 15:59:22 +00:00
|
|
|
|
2015-06-20 05:09:03 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
2015-08-26 10:15:16 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
|
2016-11-08 15:59:22 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-qunit' );
|
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-watch' );
|
2015-08-26 10:15:16 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-jscs' );
|
2015-06-20 05:09:03 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-jsonlint' );
|
2016-11-08 15:59:22 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-stylelint' );
|
2015-06-20 05:09:03 +00:00
|
|
|
|
|
|
|
grunt.initConfig( {
|
|
|
|
banana: {
|
|
|
|
all: 'i18n/'
|
|
|
|
},
|
2016-11-08 15:59:22 +00:00
|
|
|
jscs: {
|
|
|
|
options: {
|
2016-11-08 10:05:40 +00:00
|
|
|
config: '.jscsrc'
|
2016-11-08 15:59:22 +00:00
|
|
|
},
|
2016-11-08 10:05:40 +00:00
|
|
|
main: '<%= jshint.all %>',
|
2016-11-08 15:59:22 +00:00
|
|
|
test: {
|
|
|
|
options: {
|
|
|
|
config: 'tests/.jscsrc.js'
|
|
|
|
},
|
|
|
|
files: {
|
2016-11-08 10:05:40 +00:00
|
|
|
src: [
|
|
|
|
'tests/qunit/**/*.js',
|
|
|
|
'!tests/qunit/ext.popups.core.test.js'
|
|
|
|
]
|
2016-11-08 15:59:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2015-08-26 10:15:16 +00:00
|
|
|
jshint: {
|
|
|
|
options: {
|
|
|
|
jshintrc: true
|
|
|
|
},
|
2015-10-25 16:26:26 +00:00
|
|
|
all: [
|
2016-11-08 10:05:40 +00:00
|
|
|
'*.js',
|
|
|
|
'**/*.js',
|
|
|
|
'!node_modules/**',
|
|
|
|
'!resources/ext.popups.lib/**',
|
|
|
|
// FIXME: Remove ignores for legacy code upon removal/refactor
|
|
|
|
'!resources/ext.popups.core/**',
|
|
|
|
'!resources/ext.popups.desktop/**',
|
|
|
|
'!resources/ext.popups.images/**',
|
|
|
|
'!resources/ext.popups.renderer.desktopRenderer/**',
|
|
|
|
'!resources/ext.popups.schemaPopups/**',
|
|
|
|
'!resources/ext.popups.schemaPopups.utils/**',
|
|
|
|
'!resources/ext.popups.targets.desktopTarget/**',
|
|
|
|
// End legacy code
|
|
|
|
'!tests/qunit/**'
|
2016-11-08 15:59:22 +00:00
|
|
|
],
|
|
|
|
test: {
|
|
|
|
files: {
|
|
|
|
src: 'tests/qunit/**/*.js'
|
|
|
|
}
|
|
|
|
}
|
2015-08-26 10:15:16 +00:00
|
|
|
},
|
2015-06-20 05:09:03 +00:00
|
|
|
jsonlint: {
|
|
|
|
all: [
|
2016-11-08 15:59:22 +00:00
|
|
|
'*.json',
|
2015-06-20 05:09:03 +00:00
|
|
|
'**/*.json',
|
|
|
|
'!node_modules/**'
|
|
|
|
]
|
2016-11-08 15:59:22 +00:00
|
|
|
},
|
|
|
|
qunit: {
|
|
|
|
all: {
|
|
|
|
options: {
|
2016-11-09 11:57:24 +00:00
|
|
|
timeout: 10000, // Using the filter query param takes longer
|
2016-11-08 15:59:22 +00:00
|
|
|
summaryOnly: true,
|
|
|
|
urls: [
|
2016-11-08 19:42:21 +00:00
|
|
|
// Execute any QUnit test in those module whose names begin with
|
|
|
|
// "ext.popups".
|
|
|
|
QUNIT_URL_BASE + '?filter=ext.popups'
|
2016-11-08 15:59:22 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
stylelint: {
|
|
|
|
options: {
|
|
|
|
syntax: 'less'
|
|
|
|
},
|
|
|
|
all: [
|
|
|
|
'resources/**/*.less'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
watch: {
|
2016-11-09 11:57:24 +00:00
|
|
|
options: {
|
|
|
|
interrupt: true,
|
|
|
|
debounceDelay: 1000
|
|
|
|
},
|
2016-11-08 15:59:22 +00:00
|
|
|
lint: {
|
|
|
|
files: [ 'resources/**/*.js', 'tests/qunit/**/*.js' ],
|
|
|
|
tasks: [ 'lint' ]
|
|
|
|
},
|
|
|
|
scripts: {
|
|
|
|
files: [ 'resources/**/*.js', 'tests/qunit/**/*.js' ],
|
|
|
|
tasks: [ 'test' ]
|
|
|
|
},
|
|
|
|
configFiles: {
|
|
|
|
files: [ 'Gruntfile.js' ],
|
|
|
|
options: {
|
|
|
|
reload: true
|
|
|
|
}
|
|
|
|
}
|
2015-06-20 05:09:03 +00:00
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
2016-11-08 15:59:22 +00:00
|
|
|
grunt.registerTask( 'lint', [ 'jshint', 'jscs', 'jsonlint', 'banana' ] );
|
|
|
|
grunt.registerTask( 'test', [ 'qunit' ] );
|
|
|
|
grunt.registerTask( 'default', [ 'test', 'lint' ] );
|
2015-06-20 05:09:03 +00:00
|
|
|
};
|