cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brianler...@apache.org
Subject js commit: begin distilling tests out
Date Wed, 11 Dec 2013 23:15:38 GMT
Updated Branches:
  refs/heads/master b75096a1b -> 67c9259e4


begin distilling tests out


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/67c9259e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/67c9259e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/67c9259e

Branch: refs/heads/master
Commit: 67c9259e411055a4e4c6293dfc25c0455713e165
Parents: b75096a
Author: brianleroux <b@brian.io>
Authored: Thu Dec 12 10:15:14 2013 +1100
Committer: brianleroux <b@brian.io>
Committed: Thu Dec 12 10:15:14 2013 +1100

----------------------------------------------------------------------
 tasks/lib/collect.js | 38 ++++++++++++++++++++++++++++++++++++++
 test/runner.js       | 31 +++++++++----------------------
 2 files changed, 47 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/67c9259e/tasks/lib/collect.js
----------------------------------------------------------------------
diff --git a/tasks/lib/collect.js b/tasks/lib/collect.js
new file mode 100644
index 0000000..0ff45e4
--- /dev/null
+++ b/tasks/lib/collect.js
@@ -0,0 +1,38 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var fs = require('fs');
+var _path = require('path'); // FIXME _path? seriously?!
+
+module.exports = function collect(path, files, matches) {
+    matches = matches || function (path) {
+        return path.match(/test\.(\w|-)+\.js$/);
+    }; 
+
+    if (fs.statSync(path).isDirectory()) {
+        fs.readdirSync(path).forEach(function (item) {
+            collect(_path.join(path, item), files, matches);
+        });
+    }
+    else if (matches(path)) {
+        files.push(path);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/67c9259e/test/runner.js
----------------------------------------------------------------------
diff --git a/test/runner.js b/test/runner.js
index b6ac4af..23b5702 100644
--- a/test/runner.js
+++ b/test/runner.js
@@ -19,28 +19,15 @@
  *
 */
 
-var fs = require('fs'),
-    util = require('util'),
-    _path = require('path'),
-    tests = [],
-    packager = require('./../tasks/lib/packager'),
-    bundle = require('./../tasks/lib/packager'),
-    exec = require('child_process').exec;
+var fs       = require('fs');
+var util     = require('util');
+var _path    = require('path');
+var exec     = require('child_process').exe;
+var tests    = [];
+var packager = require('./../tasks/lib/packager');
+var bundle   = require('./../tasks/lib/bundle');
+var collect  = require('./../tasks/lib/collect');
 
-// FIXME this seems to be a copy of module in tasks/lib =/
-function collect(path, files, matches) {
-    matches = matches || function (path) {
-        return path.match(/test\.(\w|-)+\.js$/);
-    };
-
-    if (fs.statSync(path).isDirectory()) {
-        fs.readdirSync(path).forEach(function (item) {
-            collect(_path.join(path, item), files, matches);
-        });
-    } else if (matches(path)) {
-        files.push(path);
-    }
-}
 
 module.exports = {
     node: function(callback) {
@@ -103,7 +90,7 @@ module.exports = {
             modules,
             specs,
             app = connect(
-                connect.static(_path.join(__dirname, '..', 'thirdparty')),
+                connect.static(_path.join(__dirname, '..', 'tasks', 'vendor')),
                 connect.static(__dirname),
                 connect.router(function (app) {
                     app.get('/cordova.test.js', function (req, res) {


Mime
View raw message