cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dase...@apache.org
Subject cordova-plugin-test-framework git commit: CB-10636 Add JSHint for plugins
Date Wed, 02 Mar 2016 09:02:15 GMT
Repository: cordova-plugin-test-framework
Updated Branches:
  refs/heads/master c1c38f589 -> 1555a42b4


CB-10636 Add JSHint for plugins


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/commit/1555a42b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/tree/1555a42b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/diff/1555a42b

Branch: refs/heads/master
Commit: 1555a42b4c23b290db9108c01ec1a8c4b33fbf3c
Parents: c1c38f5
Author: daserge <v-seshak@microsoft.com>
Authored: Tue Mar 1 12:48:59 2016 +0300
Committer: daserge <v-seshak@microsoft.com>
Committed: Tue Mar 1 12:50:47 2016 +0300

----------------------------------------------------------------------
 .gitignore                   |  2 ++
 .jshintignore                |  2 ++
 .jshintrc                    | 18 ++++++++++++
 .travis.yml                  |  4 +++
 README.md                    |  2 ++
 package.json                 |  9 +++++-
 www/assets/jasmine-medic.js  | 59 ++++++++++-----------------------------
 www/assets/main-bootstrap.js |  4 +--
 www/jasmine_helpers.js       |  3 +-
 www/main.js                  |  4 ++-
 www/medic.js                 |  3 +-
 www/tests.js                 |  7 +++--
 12 files changed, 64 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/blob/1555a42b/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index fd29596..ad0ff3e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
 # OS X
 .DS_Store
+
+node_modules

http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/blob/1555a42b/.jshintignore
----------------------------------------------------------------------
diff --git a/.jshintignore b/.jshintignore
new file mode 100644
index 0000000..a1b23bd
--- /dev/null
+++ b/.jshintignore
@@ -0,0 +1,2 @@
+www/assets/jasmine-2.2.0
+www/assets/topcoat-0.7.5

http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/blob/1555a42b/.jshintrc
----------------------------------------------------------------------
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..a09a8f1
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,18 @@
+{
+    "browser": true
+  , "devel": true
+  , "bitwise": true
+  , "undef": true
+  , "trailing": true
+  , "quotmark": false
+  , "indent": 4
+  , "unused": "vars"
+  , "latedef": "nofunc"
+  , "globals": {
+        "module": false,
+        "exports": false,
+        "require": false,
+        "cordova": true,
+        "jasmineRequire": false
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/blob/1555a42b/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..b9af4c5
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+sudo: false
+node_js:
+  - "4.2"

http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/blob/1555a42b/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index f47811a..7da78d8 100644
--- a/README.md
+++ b/README.md
@@ -19,6 +19,8 @@
 #
 -->
 
+[![Build Status](https://travis-ci.org/apache/cordova-plugin-test-framework.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-test-framework)
+
 # Cordova Plugin Test Framework
 
 The `cordova-plugin-test-framework` plugin does two things:

http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/blob/1555a42b/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 8d530ea..7460f62 100644
--- a/package.json
+++ b/package.json
@@ -15,6 +15,13 @@
     "test",
     "ecosystem:cordova"
   ],
+  "scripts": {
+    "test": "npm run jshint",
+    "jshint": "jshint www"
+  },
   "author": "Apache Software Foundation",
-  "license": "Apache 2.0"
+  "license": "Apache 2.0",
+  "devDependencies": {
+    "jshint": "^2.6.0"
+  }
 }

http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/blob/1555a42b/www/assets/jasmine-medic.js
----------------------------------------------------------------------
diff --git a/www/assets/jasmine-medic.js b/www/assets/jasmine-medic.js
index 57eb426..4194f3a 100644
--- a/www/assets/jasmine-medic.js
+++ b/www/assets/jasmine-medic.js
@@ -19,6 +19,8 @@
  *
 */
 
+/* global device */
+
 jasmineRequire.medic = function(j$) {
   j$.MedicReporter = jasmineRequire.MedicReporter(j$);
 };
@@ -29,25 +31,24 @@ jasmineRequire.MedicReporter = function(j$) {
     elapsed: function() { return 0; }
   };
 
+  var platformMap = {
+    'ipod touch':'ios',
+    'iphone':'ios'
+  };
+
   function MedicReporter(options) {
-    var env = options.env || {},
-    logoptions = options.log || { logurl: 'http://127.0.0.1:5984/' }, // TODO: http://localhost:6800
-    getContainer = options.getContainer,
-    createElement = options.createElement,
-    createTextNode = options.createTextNode,
-    onRaiseExceptionsClick = options.onRaiseExceptionsClick || function() {},
+    var logoptions = options.log || { logurl: 'http://127.0.0.1:5984/' }, // TODO: http://localhost:6800
     timer = options.timer || noopTimer,
     results = [],
     specsExecuted = 0,
     failureCount = 0,
-    pendingSpecCount = 0,
-    symbols;
+    pendingSpecCount = 0;
 
 
     var serverurl = logoptions.logurl;
 
     this.initialize = function() {
-    }
+    };
 
     var totalSpecsDefined;
     this.jasmineStarted = function(options) {
@@ -55,9 +56,6 @@ jasmineRequire.MedicReporter = function(j$) {
       timer.start();
     };
 
-    var topResults = new j$.ResultsNode({}, "", null),
-    currentParent = topResults;
-
     this.suiteStarted = function(result) {
     };
 
@@ -69,7 +67,6 @@ jasmineRequire.MedicReporter = function(j$) {
       // Start timing this spec
     };
 
-    var failures = [];
     this.specDone = function(result) {
       if (result.status != "disabled") {
         specsExecuted++;
@@ -83,10 +80,10 @@ jasmineRequire.MedicReporter = function(j$) {
       }
     };
 
-    buildResults = function(){
+    var buildResults = function(){
       var json ={specs:specsExecuted, failures:failureCount, results: results};
       return json;
-    }
+    };
 
     this.jasmineDone = function() {
       var p = 'Desktop';
@@ -109,20 +106,6 @@ jasmineRequire.MedicReporter = function(j$) {
 
     };
 
-
-    logresult = function(){
-      if(failureCount>0 ) {
-        console.log('[[[ TEST OK ]]]');
-      } else {
-        console.log('[[[ TEST FAILED ]]]');
-      }
-      logfinished();
-    };
-
-    var logfinished = function(){
-      console.log('>>> DONE <<<');
-    };
-
     this.postTests = function(json) {
       console.log('posting tests');
 
@@ -130,25 +113,11 @@ jasmineRequire.MedicReporter = function(j$) {
       var doc_id = [options.sha, json.version, json.model].map(encodeURIComponent).join('__');
       var doc_url = serverurl + '/mobilespec_results/' + doc_id;
       xhr.open("PUT", doc_url, true);
-      xhr.setRequestHeader("Content-Type","application/json")
+      xhr.setRequestHeader("Content-Type","application/json");
       xhr.send(JSON.stringify(json));
-    }
+    };
     return this;
   }
 
-   /**
-   * Calculate elapsed time, in Seconds.
-   * @param startMs Start time in Milliseconds
-   * @param finishMs Finish time in Milliseconds
-   * @return Elapsed time in Seconds */
-  function elapsedSec(startMs, finishMs) {
-    return (finishMs - startMs) / 1000;
-  }
-
-  var platformMap = {
-    'ipod touch':'ios',
-    'iphone':'ios'
-  };
-
   return MedicReporter;
 };

http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/blob/1555a42b/www/assets/main-bootstrap.js
----------------------------------------------------------------------
diff --git a/www/assets/main-bootstrap.js b/www/assets/main-bootstrap.js
index 44a3bff..58624b7 100644
--- a/www/assets/main-bootstrap.js
+++ b/www/assets/main-bootstrap.js
@@ -19,8 +19,8 @@
  *
 */
 
-'use strict';
-
 document.addEventListener("deviceready", function() {
+  'use strict';
+
   cordova.require('cordova-plugin-test-framework.main').init();
 });

http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/blob/1555a42b/www/jasmine_helpers.js
----------------------------------------------------------------------
diff --git a/www/jasmine_helpers.js b/www/jasmine_helpers.js
index e6a0c1e..c007104 100644
--- a/www/jasmine_helpers.js
+++ b/www/jasmine_helpers.js
@@ -19,6 +19,7 @@
  *
 */
 
+/* jshint -W097 */
 'use strict';
 
 exports.setUpJasmine = function() {
@@ -48,7 +49,7 @@ exports.setUpJasmine = function() {
     };
 
     return jasmineInterface;
-}
+};
 
 function addJasmineReporters(jasmineInterface, jasmineEnv) {
     jasmineInterface.jsApiReporter = new jasmineInterface.jasmine.JsApiReporter({ timer:
new jasmineInterface.jasmine.Timer() });

http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/blob/1555a42b/www/main.js
----------------------------------------------------------------------
diff --git a/www/main.js b/www/main.js
index 7e6eccb..954af80 100644
--- a/www/main.js
+++ b/www/main.js
@@ -19,6 +19,8 @@
  *
 */
 
+/* global WinJS */
+/* jshint -W097 */
 'use strict';
 
 var LOG_HEADER_HEIGHT = 20,
@@ -239,7 +241,7 @@ function createEnablerList() {
 
     barItem.appendChild(link);
     checkButtonBar.appendChild(barItem);
-  };
+  }
   createSelectToggleButton('Check all', true);
   createSelectToggleButton('Uncheck all', false);
   enablerList.appendChild(checkButtonBar);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/blob/1555a42b/www/medic.js
----------------------------------------------------------------------
diff --git a/www/medic.js b/www/medic.js
index 740ad84..47f261f 100644
--- a/www/medic.js
+++ b/www/medic.js
@@ -19,6 +19,7 @@
  *
 */
 
+/* jshint -W097 */
 'use strict';
 
 exports.logurl = 'http://127.0.0.1:7800';
@@ -59,4 +60,4 @@ exports.load = function (callback) {
   setTimeout(function () {
       callback();
   }, 0);
-}
+};

http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/blob/1555a42b/www/tests.js
----------------------------------------------------------------------
diff --git a/www/tests.js b/www/tests.js
index 727ac60..cea8898 100644
--- a/www/tests.js
+++ b/www/tests.js
@@ -19,6 +19,8 @@
  *
 */
 
+/* jshint jasmine: true */
+/* jshint -W097 */
 'use strict';
 
 exports.tests = Object.create(null);
@@ -44,7 +46,8 @@ function TestModule(api) {
 }
 
 function getTestsObject(api) {
-  return exports.tests[api] = exports.tests[api] || new TestModule(api);
+  exports.tests[api] = exports.tests[api] || new TestModule(api);
+  return exports.tests[api];
 }
 
 function requireAllTestModules() {
@@ -129,4 +132,4 @@ exports.defineManualTests = function(contentEl, beforeEach, createActionButton)
 
 exports.init = function() {
   requireAllTestModules();
-}
+};


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message