jenkins-bot has submitted this change and it was merged.
Change subject: Add qunit and file watching support with grunt
......................................................................
Add qunit and file watching support with grunt
New tasks added:
* grunt qunit (runs tests)
* grunt watch (watches js files, when changed auto runs linters and tests
* grunt test (now runs tests also)
* grunt ((default) refers to the test objective for the moment)
Change-Id: I11f3c41973621b9cf3132908a4cf24fca17d9690
---
M Gruntfile.js
M package.json
2 files changed, 35 insertions(+), 6 deletions(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/Gruntfile.js b/Gruntfile.js
index e4a7488..87b90a7 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -10,28 +10,55 @@
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-jscs' );
+ grunt.loadNpmTasks('grunt-contrib-qunit');
+ grunt.loadNpmTasks('grunt-contrib-watch');
grunt.initConfig( {
pkg: grunt.file.readJSON( 'package.json' ),
+ URL: process.env.URL || 'http://127.0.0.1:8080/w/index.php/',
+ QUNIT_FILTER: (process.env.QUNIT_FILTER &&
'&filter='+process.env.QUNIT_FILTER) || '',
+ files: {
+ js: 'javascripts/**/*.js',
+ jsTests: 'tests/qunit/**/*.js',
+ },
jshint: {
options: {
jshintrc: true
},
all: [
- 'javascripts/**/*.js',
+ '<%= files.js %>',
'!javascripts/externals/**/*.js'
]
},
jscs: {
src: '<%= jshint.all %>',
options: {
- config: ".jscs.json"
+ config: '.jscs.json'
+ }
+ },
+ qunit: {
+ all: {
+ options: {
+ urls: [ '<%= URL
%>Special:JavaScriptTest/qunit?useformat=mobile<%= QUNIT_FILTER %>' ]
+ }
+ }
+ },
+ watch: {
+ scripts: {
+ files: [ '<%= files.js %>', '<%= files.jsTests
%>' ],
+ tasks: [ 'test' ]
+ },
+ configFiles: {
+ files: [ 'Gruntfile.js' ],
+ options: {
+ reload: true
+ }
}
}
} );
// Jenkins automatically runs grunt test for us
- grunt.registerTask( 'test', [ 'jshint', 'jscs' ] );
- grunt.registerTask( 'default', [ 'jshint', 'jscs' ] );
+ grunt.registerTask( 'test', [ 'jshint', 'jscs', 'qunit' ] );
+ grunt.registerTask( 'default', [ 'test' ] );
-};
\ No newline at end of file
+};
diff --git a/package.json b/package.json
index 7419798..73c3924 100644
--- a/package.json
+++ b/package.json
@@ -14,6 +14,8 @@
"devDependencies": {
"grunt-contrib-jshint": "0.10.0",
"grunt-jscs": "0.8.1",
- "js-beautify": "^1.5.4"
+ "js-beautify": "^1.5.4",
+ "grunt-contrib-qunit": "^0.5.2",
+ "grunt-contrib-watch": "0.6.1"
}
}
--
To view, visit https://gerrit.wikimedia.org/r/169292
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I11f3c41973621b9cf3132908a4cf24fca17d9690
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits