Jhernandez has uploaded a new change for review.
https://gerrit.wikimedia.org/r/169292
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(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/92/169292/1
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 ee7de4b..09ee8f1 100644
--- a/package.json
+++ b/package.json
@@ -13,6 +13,8 @@
},
"devDependencies": {
"grunt-contrib-jshint": "0.10.0",
- "grunt-jscs": "0.8.1"
+ "grunt-contrib-qunit": "^0.5.2",
+ "grunt-jscs": "0.8.1",
+ "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: newchange
Gerrit-Change-Id: I11f3c41973621b9cf3132908a4cf24fca17d9690
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits