jenkins-bot has submitted this change and it was merged.

Change subject: Add npm test
......................................................................


Add npm test

Per https://gerrit.wikimedia.org/r/#/c/290943/

Also various patches to MWStew set-up:
* Reuse: conf.MessagesDirs
* Add linebreak to end of Gruntfile
* Rename modules/ files
* Rename js test file in Hooks
* Capitalize alias name
* Updated localBasePath in Hooks
* Moving ext.wikispeech to ResourceModules in extension.json
* Adding ResourceFileModulePaths to extension.json
* Add predef to .jshintrc

Bug: T136196
Change-Id: Ib68f54f0c7e4e21237a97882c374a638bbdd82bd
---
M .jshintrc
M Gruntfile.js
M Hooks.php
M Wikispeech.alias.php
M extension.json
R modules/ext.wikispeech.css
R modules/ext.wikispeech.js
M package.json
M tests/Wikispeech.test.js
9 files changed, 34 insertions(+), 20 deletions(-)

Approvals:
  Paladox: Looks good to me, but someone else must approve
  Sebastian Berlin (WMSE): Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.jshintrc b/.jshintrc
index 4ecb7d5..5cbb855 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -1,4 +1,10 @@
 {
+       "predef": [
+               "mediaWiki",
+               "jQuery",
+               "QUnit"
+       ],
+
        // Enforcing
        "bitwise": true,
        "eqeqeq": true,
@@ -17,4 +23,4 @@
                "mw": false,
                "$": false
        }
-}
\ No newline at end of file
+}
diff --git a/Gruntfile.js b/Gruntfile.js
index dd8535b..9da849a 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -1,5 +1,6 @@
 /*jshint node:true */
 module.exports = function ( grunt ) {
+       var conf = grunt.file.readJSON( 'extension.json' );
        grunt.loadNpmTasks( 'grunt-contrib-jshint' );
        grunt.loadNpmTasks( 'grunt-jsonlint' );
        grunt.loadNpmTasks( 'grunt-banana-checker' );
@@ -18,9 +19,7 @@
                jscs: {
                        src: '<%= jshint.all %>'
                },
-               banana: {
-                       all: 'i18n/'
-               },
+               banana: conf.MessagesDirs,
                jsonlint: {
                        all: [
                                '*.json',
@@ -32,4 +31,4 @@
 
        grunt.registerTask( 'test', [ 'jshint', 'jscs', 'jsonlint', 'banana' ] 
);
        grunt.registerTask( 'default', 'test' );
-};
\ No newline at end of file
+};
diff --git a/Hooks.php b/Hooks.php
index b80adc4..e158e1a 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -18,12 +18,12 @@
        public static function onResourceLoaderTestModules( array 
&$testModules, ResourceLoader &$resourceLoader ) {
                $testModules['qunit']['ext.wikispeech.tests'] = [
                        'scripts' => [
-                               'tests/ext.Wikispeech.test.js'
+                               'tests/Wikispeech.test.js'
                        ],
                        'dependencies' => [
                                'ext.wikispeech'
                        ],
-                       'localBasePath' => __DIR__ . '/..',
+                       'localBasePath' => __DIR__,
                        'remoteExtPath' => 'Wikispeech',
                ];
                return true;
diff --git a/Wikispeech.alias.php b/Wikispeech.alias.php
index 71dd9e2..b0fc561 100644
--- a/Wikispeech.alias.php
+++ b/Wikispeech.alias.php
@@ -8,5 +8,5 @@
 
 /** English (English) */
 $specialPageAliases['en'] = array(
-       'wikispeech' => array( 'wikispeech' ),
+       'Wikispeech' => array( 'Wikispeech' ),
 );
diff --git a/extension.json b/extension.json
index 22bea55..cdbc489 100644
--- a/extension.json
+++ b/extension.json
@@ -19,19 +19,25 @@
         "SpecialWikispeech": "specials/SpecialWikispeech.php",
         "WikispeechHooks": "Hooks.php"
     },
-    "ext.wikispeech": {
-        "scripts": [
-            "modules/ext.wikispeech.js"
-        ],
-        "styles": [
-            "modules/ext.wikispeech.css"
-        ],
-        "messages": [
+    "ResourceModules": {
+        "ext.wikispeech": {
+            "scripts": [
+                "ext.wikispeech.js"
+            ],
+            "styles": [
+                "ext.wikispeech.css"
+            ],
+            "messages": [
 
-        ],
-        "dependencies": [
+            ],
+            "dependencies": [
 
-        ]
+            ]
+        }
+    },
+    "ResourceFileModulePaths": {
+        "localBasePath": "modules",
+        "remoteExtPath": "Wikispeech/modules"
     },
     "SpecialPages": {
         "Wikispeech": "SpecialWikispeech"
diff --git a/modules/ext.Wikispeech.css b/modules/ext.wikispeech.css
similarity index 100%
rename from modules/ext.Wikispeech.css
rename to modules/ext.wikispeech.css
diff --git a/modules/ext.Wikispeech.js b/modules/ext.wikispeech.js
similarity index 100%
rename from modules/ext.Wikispeech.js
rename to modules/ext.wikispeech.js
diff --git a/package.json b/package.json
index 9859ea3..ea896d0 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,9 @@
 {
   "name": "Wikispeech",
   "version": "0.0.1",
+  "scripts": {
+    "test": "grunt test"
+  },
   "devDependencies": {
     "grunt": "0.4.5",
     "grunt-cli": "0.1.13",
diff --git a/tests/Wikispeech.test.js b/tests/Wikispeech.test.js
index eda77fe..5e5f3ad 100644
--- a/tests/Wikispeech.test.js
+++ b/tests/Wikispeech.test.js
@@ -1,4 +1,4 @@
-( function ( mw, $ ) {
+( function () {
        QUnit.module( 'ext.wikispeech' );
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/291213
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib68f54f0c7e4e21237a97882c374a638bbdd82bd
Gerrit-PatchSet: 9
Gerrit-Project: mediawiki/extensions/Wikispeech
Gerrit-Branch: master
Gerrit-Owner: Lokal Profil <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: Sebastian Berlin (WMSE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to