cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an-s...@apache.org
Subject js commit: CB-9429 Enables jsdom/browser tests for browserify.
Date Fri, 31 Jul 2015 13:59:12 GMT
Repository: cordova-js
Updated Branches:
  refs/heads/master 64e371e95 -> 2c29e187e


CB-9429 Enables jsdom/browser tests for browserify.

This closes #123.


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

Branch: refs/heads/master
Commit: 2c29e187e4206a6a77fba940ef6f77aef5c7eb8c
Parents: 64e371e
Author: Vladimir Kotikov <v-vlkoti@microsoft.com>
Authored: Wed Jul 29 13:42:11 2015 +0300
Committer: Vladimir Kotikov <v-vlkoti@microsoft.com>
Committed: Fri Jul 31 17:00:25 2015 +0300

----------------------------------------------------------------------
 Gruntfile.js                                  |   8 +-
 package.json                                  |   6 +-
 src/legacy-exec/test/exec.js                  |  22 ++++
 src/legacy-exec/test/platform.js              |  36 ++++++
 src/legacy-exec/test/test/mockxhr.js          | 123 +++++++++++++++++++++
 src/legacy-exec/test/test/modulereplacer.js   |  33 ++++++
 src/legacy-exec/test/test/propertyreplacer.js |  48 ++++++++
 src/legacy-exec/test/test/testmodule.js       |  27 +++++
 src/test/exec.js                              |  22 ----
 src/test/mockxhr.js                           | 123 ---------------------
 src/test/modulereplacer.js                    |  33 ------
 src/test/platform.js                          |  36 ------
 src/test/propertyreplacer.js                  |  48 --------
 src/test/testmodule.js                        |  27 -----
 tasks/lib/bundle-browserify.js                |  26 ++++-
 tasks/lib/bundle.js                           |  23 ++--
 tasks/lib/packager-browserify.js              |  17 ++-
 tasks/lib/require-tr.js                       |  17 ++-
 tasks/lib/test-browser.js                     |  49 ++++----
 tasks/lib/test-jsdom.js                       |  16 ++-
 tasks/templates/suite.html                    |   6 +-
 tasks/test.js                                 |   4 +-
 test/ios/test.exec.js                         |  13 ++-
 test/test.modulemapper.js                     |  68 ++++++------
 24 files changed, 445 insertions(+), 386 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index 68f70b0..8869b7a 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -40,7 +40,7 @@ module.exports = function(grunt) {
             "blackberry10": {},
             "ios": {},
             "osx": {},
-            //"test": {},
+            "test": {},
             "windows": { useWindowsLineEndings: true },
             "wp8": { useWindowsLineEndings: true },
             "firefoxos": {},
@@ -67,7 +67,9 @@ module.exports = function(grunt) {
     // defaults
     grunt.registerTask('default', ['build', 'test']);
     grunt.registerTask('build', ['compile', 'jshint', 'whitespace-check']);
-    grunt.registerTask('test', ['compile', 'jshint', '_test']);
-    grunt.registerTask('btest', ['compile', '_btest']);
+    grunt.registerTask('test', ['compile:test', 'jshint', '_test']);
+    grunt.registerTask('btest', ['compile:test', 'jshint', '_btest']);
     grunt.registerTask('cover', ['compile', '_cover']);
+    grunt.registerTask('test-browserify', ['compile-browserify:test', 'jshint', '_test:skip-tests']);
+    grunt.registerTask('btest-browserify', ['compile-browserify:test', 'jshint', '_btest:skip-tests']);
 };

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 763a33a..7139292 100644
--- a/package.json
+++ b/package.json
@@ -62,13 +62,15 @@
   "devDependencies": {
     "connect": "1.8.5",
     "grunt": "0.4.1",
+    "grunt-cli": "0.1.13",
     "grunt-contrib-clean": "0.6.0",
     "grunt-contrib-jshint": "0.10.0",
     "istanbul": "^0.3.4",
     "jasmine-node": "1.14.5",
-    "node-jsdom": "~3.x",
     "mkdirp": "^0.5.0",
-    "grunt-cli": "0.1.13"
+    "node-jsdom": "~3.x",
+    "open": "0.0.5",
+    "through2": "^2.0.0"
   },
   "dependencies": {
     "browserify": "10.1.3",

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/src/legacy-exec/test/exec.js
----------------------------------------------------------------------
diff --git a/src/legacy-exec/test/exec.js b/src/legacy-exec/test/exec.js
new file mode 100644
index 0000000..a5ea8e8
--- /dev/null
+++ b/src/legacy-exec/test/exec.js
@@ -0,0 +1,22 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+module.exports = jasmine.createSpy();

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/src/legacy-exec/test/platform.js
----------------------------------------------------------------------
diff --git a/src/legacy-exec/test/platform.js b/src/legacy-exec/test/platform.js
new file mode 100644
index 0000000..b0ff2d7
--- /dev/null
+++ b/src/legacy-exec/test/platform.js
@@ -0,0 +1,36 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+module.exports = {
+    id: 'test platform',
+    bootstrap: function() {
+        var propertyreplacer = require('cordova/test/propertyreplacer');
+
+        require('cordova/builder').replaceHookForTesting = function(obj, key) {
+            // This doesn't clean up non-clobbering assignments, nor does it work for
+            // getters. It does work to un-clobber clobbered / merged symbols, which
+            // is generally good enough for tests.
+            if (obj[key]) {
+                propertyreplacer.stub(obj, key);
+            }
+        };
+    }
+};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/src/legacy-exec/test/test/mockxhr.js
----------------------------------------------------------------------
diff --git a/src/legacy-exec/test/test/mockxhr.js b/src/legacy-exec/test/test/mockxhr.js
new file mode 100644
index 0000000..871811d
--- /dev/null
+++ b/src/legacy-exec/test/test/mockxhr.js
@@ -0,0 +1,123 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+/*jshint -W020 */
+
+var utils = require('cordova/utils');
+var activeXhrs = [];
+var isInstalled = false;
+var origXhr = this.XMLHttpRequest;
+
+function MockXhr() {
+    this.requestHeaders = {};
+    this.readyState = 0;
+
+    this.onreadystatechange = null;
+    this.onload = null;
+    this.onerror = null;
+    this.clearResponse_();
+}
+
+MockXhr.prototype.clearResponse_ = function() {
+    this.url = null;
+    this.method = null;
+    this.async = null;
+    this.requestPayload = undefined;
+
+    this.statusCode = 0;
+    this.responseText = '';
+    this.responseHeaders = {};
+};
+
+MockXhr.prototype.setReadyState_ = function(value) {
+    this.readyState = value;
+    this.onreadystatechange && this.onreadystatechange();
+};
+
+MockXhr.prototype.open = function(method, url, async) {
+    if (this.readyState !== 0 && this.readyState !== 4) {
+        throw Error('Tried to open MockXhr while request in progress.');
+    }
+    this.clearResponse_();
+    this.method = method;
+    this.url = url;
+    this.async = async;
+    this.setReadyState_(1);
+};
+
+MockXhr.prototype.setRequestHeader = function(key, val) {
+    if (this.readyState != 1) {
+        throw Error('Tried to setRequestHeader() without call to open()');
+    }
+    this.requestHeaders[key] = String(val);
+};
+
+MockXhr.prototype.send = function(payload) {
+    if (this.readyState != 1) {
+        throw Error('Tried to send MockXhr without call to open().');
+    }
+    this.requestPayload = payload;
+    this.setReadyState_(2);
+
+    activeXhrs.push(this);
+};
+
+MockXhr.prototype.simulateResponse = function(statusCode, responseText, responseHeaders) {
+    if (this.readyState != 2) {
+        throw Error('Call to simulateResponse() when MockXhr is in state ' + this.readyState);
+    }
+    for (var i = this.readyState; i <= 4; i++) {
+        if (i == 2) {
+            this.statusCode = statusCode;
+            this.responseHeaders = responseHeaders || this.responseHeaders;
+        }
+        if (i == 4) {
+            this.responseText = responseText;
+        }
+        this.setReadyState_(i);
+    }
+    if (statusCode == 200) {
+        this.onload && this.onload();
+    } else {
+        this.onerror && this.onerror();
+    }
+    utils.arrayRemove(activeXhrs, this);
+};
+
+function install() {
+    if (isInstalled) {
+        throw Error('mockxhr.install called without uninstall.');
+    }
+    isInstalled = true;
+    activeXhrs.length = 0;
+    XMLHttpRequest = MockXhr;
+}
+
+function uninstall() {
+    XMLHttpRequest = origXhr;
+    isInstalled = false;
+}
+
+module.exports = {
+    install: install,
+    uninstall: uninstall,
+    activeXhrs: activeXhrs
+};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/src/legacy-exec/test/test/modulereplacer.js
----------------------------------------------------------------------
diff --git a/src/legacy-exec/test/test/modulereplacer.js b/src/legacy-exec/test/test/modulereplacer.js
new file mode 100644
index 0000000..f9f1c0c
--- /dev/null
+++ b/src/legacy-exec/test/test/modulereplacer.js
@@ -0,0 +1,33 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+/*global spyOn:false */
+
+var propertyreplacer = require('cordova/test/propertyreplacer');
+
+exports.replace = function(moduleName, newValue) {
+    propertyreplacer.stub(define.moduleMap, moduleName, null);
+    define.remove(moduleName);
+    define(moduleName, function(require, exports, module) {
+        module.exports = newValue;
+    });
+};
+

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/src/legacy-exec/test/test/propertyreplacer.js
----------------------------------------------------------------------
diff --git a/src/legacy-exec/test/test/propertyreplacer.js b/src/legacy-exec/test/test/propertyreplacer.js
new file mode 100644
index 0000000..18c5d3b
--- /dev/null
+++ b/src/legacy-exec/test/test/propertyreplacer.js
@@ -0,0 +1,48 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+
+// Use this helper module to stub out properties within Jasmine tests.
+// Original values will be restored after each test.
+
+var curStubs = null;
+
+function removeAllStubs() {
+    for (var i = curStubs.length - 1, stub; stub = curStubs[i]; --i) {
+        stub.obj[stub.key] = stub.value;
+    }
+    curStubs = null;
+}
+
+exports.stub = function(obj, key, value) {
+    if (!curStubs) {
+        curStubs = [];
+        jasmine.getEnv().currentSpec.after(removeAllStubs);
+    }
+
+    curStubs.push({
+        obj: obj,
+        key: key,
+        value: obj[key]
+    });
+    obj[key] = value;
+};
+

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/src/legacy-exec/test/test/testmodule.js
----------------------------------------------------------------------
diff --git a/src/legacy-exec/test/test/testmodule.js b/src/legacy-exec/test/test/testmodule.js
new file mode 100644
index 0000000..80eaf94
--- /dev/null
+++ b/src/legacy-exec/test/test/testmodule.js
@@ -0,0 +1,27 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+module.exports = {
+    func: function() {},
+    num: 2,
+    obj: { str: 'hello' },
+    subObj: { str: 'testSubObj' }
+};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/src/test/exec.js
----------------------------------------------------------------------
diff --git a/src/test/exec.js b/src/test/exec.js
deleted file mode 100644
index a5ea8e8..0000000
--- a/src/test/exec.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- *
- * 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.
- *
-*/
-
-module.exports = jasmine.createSpy();

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/src/test/mockxhr.js
----------------------------------------------------------------------
diff --git a/src/test/mockxhr.js b/src/test/mockxhr.js
deleted file mode 100644
index 871811d..0000000
--- a/src/test/mockxhr.js
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- *
- * 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.
- *
-*/
-
-/*jshint -W020 */
-
-var utils = require('cordova/utils');
-var activeXhrs = [];
-var isInstalled = false;
-var origXhr = this.XMLHttpRequest;
-
-function MockXhr() {
-    this.requestHeaders = {};
-    this.readyState = 0;
-
-    this.onreadystatechange = null;
-    this.onload = null;
-    this.onerror = null;
-    this.clearResponse_();
-}
-
-MockXhr.prototype.clearResponse_ = function() {
-    this.url = null;
-    this.method = null;
-    this.async = null;
-    this.requestPayload = undefined;
-
-    this.statusCode = 0;
-    this.responseText = '';
-    this.responseHeaders = {};
-};
-
-MockXhr.prototype.setReadyState_ = function(value) {
-    this.readyState = value;
-    this.onreadystatechange && this.onreadystatechange();
-};
-
-MockXhr.prototype.open = function(method, url, async) {
-    if (this.readyState !== 0 && this.readyState !== 4) {
-        throw Error('Tried to open MockXhr while request in progress.');
-    }
-    this.clearResponse_();
-    this.method = method;
-    this.url = url;
-    this.async = async;
-    this.setReadyState_(1);
-};
-
-MockXhr.prototype.setRequestHeader = function(key, val) {
-    if (this.readyState != 1) {
-        throw Error('Tried to setRequestHeader() without call to open()');
-    }
-    this.requestHeaders[key] = String(val);
-};
-
-MockXhr.prototype.send = function(payload) {
-    if (this.readyState != 1) {
-        throw Error('Tried to send MockXhr without call to open().');
-    }
-    this.requestPayload = payload;
-    this.setReadyState_(2);
-
-    activeXhrs.push(this);
-};
-
-MockXhr.prototype.simulateResponse = function(statusCode, responseText, responseHeaders) {
-    if (this.readyState != 2) {
-        throw Error('Call to simulateResponse() when MockXhr is in state ' + this.readyState);
-    }
-    for (var i = this.readyState; i <= 4; i++) {
-        if (i == 2) {
-            this.statusCode = statusCode;
-            this.responseHeaders = responseHeaders || this.responseHeaders;
-        }
-        if (i == 4) {
-            this.responseText = responseText;
-        }
-        this.setReadyState_(i);
-    }
-    if (statusCode == 200) {
-        this.onload && this.onload();
-    } else {
-        this.onerror && this.onerror();
-    }
-    utils.arrayRemove(activeXhrs, this);
-};
-
-function install() {
-    if (isInstalled) {
-        throw Error('mockxhr.install called without uninstall.');
-    }
-    isInstalled = true;
-    activeXhrs.length = 0;
-    XMLHttpRequest = MockXhr;
-}
-
-function uninstall() {
-    XMLHttpRequest = origXhr;
-    isInstalled = false;
-}
-
-module.exports = {
-    install: install,
-    uninstall: uninstall,
-    activeXhrs: activeXhrs
-};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/src/test/modulereplacer.js
----------------------------------------------------------------------
diff --git a/src/test/modulereplacer.js b/src/test/modulereplacer.js
deleted file mode 100644
index b5a2461..0000000
--- a/src/test/modulereplacer.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- * 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.
- *
-*/
-
-/*global spyOn:false */
-
-var propertyreplacer = require('cordova/propertyreplacer');
-
-exports.replace = function(moduleName, newValue) {
-    propertyreplacer.stub(define.moduleMap, moduleName, null);
-    define.remove(moduleName);
-    define(moduleName, function(require, exports, module) {
-        module.exports = newValue;
-    });
-};
-

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/src/test/platform.js
----------------------------------------------------------------------
diff --git a/src/test/platform.js b/src/test/platform.js
deleted file mode 100644
index fcc31ae..0000000
--- a/src/test/platform.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *
- * 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.
- *
-*/
-
-module.exports = {
-    id: 'test platform',
-    bootstrap: function() {
-        var propertyreplacer = require('cordova/propertyreplacer');
-
-        require('cordova/builder').replaceHookForTesting = function(obj, key) {
-            // This doesn't clean up non-clobbering assignments, nor does it work for
-            // getters. It does work to un-clobber clobbered / merged symbols, which
-            // is generally good enough for tests.
-            if (obj[key]) {
-                propertyreplacer.stub(obj, key);
-            }
-        };
-    }
-};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/src/test/propertyreplacer.js
----------------------------------------------------------------------
diff --git a/src/test/propertyreplacer.js b/src/test/propertyreplacer.js
deleted file mode 100644
index 18c5d3b..0000000
--- a/src/test/propertyreplacer.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * 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.
- *
-*/
-
-
-// Use this helper module to stub out properties within Jasmine tests.
-// Original values will be restored after each test.
-
-var curStubs = null;
-
-function removeAllStubs() {
-    for (var i = curStubs.length - 1, stub; stub = curStubs[i]; --i) {
-        stub.obj[stub.key] = stub.value;
-    }
-    curStubs = null;
-}
-
-exports.stub = function(obj, key, value) {
-    if (!curStubs) {
-        curStubs = [];
-        jasmine.getEnv().currentSpec.after(removeAllStubs);
-    }
-
-    curStubs.push({
-        obj: obj,
-        key: key,
-        value: obj[key]
-    });
-    obj[key] = value;
-};
-

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/src/test/testmodule.js
----------------------------------------------------------------------
diff --git a/src/test/testmodule.js b/src/test/testmodule.js
deleted file mode 100644
index 80eaf94..0000000
--- a/src/test/testmodule.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *
- * 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.
- *
-*/
-
-module.exports = {
-    func: function() {},
-    num: 2,
-    obj: { str: 'hello' },
-    subObj: { str: 'testSubObj' }
-};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/tasks/lib/bundle-browserify.js
----------------------------------------------------------------------
diff --git a/tasks/lib/bundle-browserify.js b/tasks/lib/bundle-browserify.js
index a6b8687..50478f6 100644
--- a/tasks/lib/bundle-browserify.js
+++ b/tasks/lib/bundle-browserify.js
@@ -20,8 +20,10 @@ var fs           = require('fs');
 var path         = require('path');
 var browserify   = require('browserify');
 var require_tr   = require('./require-tr');
-var root         = path.join(__dirname, '..', '..')
-
+var root         = path.join(__dirname, '..', '..');
+var pkgJson      = require('../../package.json');
+var collectFiles = require('./collect-files');
+var copyProps    = require('./copy-props');
 
 module.exports = function bundle(platform, debug, commitId, platformVersion) {
     require_tr.platform = platform;
@@ -43,6 +45,26 @@ module.exports = function bundle(platform, debug, commitId, platformVersion) {
         b.add(path.join(root, 'src', 'legacy-exec', platform, 'platform.js'));
     }
 
+    if (platform === 'test') {
+        // Add tests to bundle
+        // TODO: Also need to include android/ios tests
+        fs.readdirSync('test').forEach(function (item) {
+            var itemPath = path.resolve('test', item);
+            if (fs.statSync(itemPath).isFile()) b.add(itemPath);
+        });
+
+        // Add rest of modules from cordova-js-src/legacy-exec directory
+        // TODO: this probably should be done for all platforms?
+        fs.readdirSync(path.join(root, 'src', 'legacy-exec', platform, platform)).forEach(function (item) {
+            var itemPath = path.resolve(root, 'src', 'legacy-exec', platform, platform, item);
+            if (fs.statSync(itemPath).isFile()) b.add(itemPath);
+        });
+
+        // Ignore fake modules from tests, otherwise browserify fails to generate bundle
+        ['your mom', 'dino', 'a', 'ModuleA', 'ModuleB', 'ModuleC']
+        .forEach(b.ignore.bind(b));
+    }
+
     b.add(path.join(root, 'src', 'scripts', 'bootstrap.js'));
 
     return b;

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/tasks/lib/bundle.js
----------------------------------------------------------------------
diff --git a/tasks/lib/bundle.js b/tasks/lib/bundle.js
index 2c1cb46..0446e72 100644
--- a/tasks/lib/bundle.js
+++ b/tasks/lib/bundle.js
@@ -35,14 +35,9 @@ module.exports = function bundle(platform, debug, commitId, platformVersion, pla
     if(fs.existsSync(platformPath) && fs.existsSync(path.join(platformPath, 'cordova-js-src'))) {
         copyProps(modules, collectFiles(path.join(platformPath, 'cordova-js-src')));
     } else {
-        if(platform !== 'test') {
-            //for platforms that don't have a release with cordova-js-src yet
-            copyProps(modules, collectFiles(path.join('src', 'legacy-exec', platform)));
-        } else {
-            //platform === test
-            copyProps(modules, collectFiles(path.join('src', platform)));
-        }
-
+        // for platforms that don't have a release with cordova-js-src yet
+        // or if platform === test
+        copyProps(modules, collectFiles(path.join('src', 'legacy-exec', platform)));
     }
     //test doesn't support custom paths
     if (platform === 'test') {
@@ -68,7 +63,7 @@ module.exports = function bundle(platform, debug, commitId, platformVersion, pla
     }
 
     var output = [];
-  
+
     output.push("// Platform: " + platform);
     output.push("// "  + commitId);
 
@@ -82,16 +77,16 @@ module.exports = function bundle(platform, debug, commitId, platformVersion, pla
     if (!scripts['require']) {
         throw new Error("didn't find a script for 'require'")
     }
-    
+
     writeScript(output, scripts['require'], debug)
 
     // write modules
     var moduleIds = Object.keys(modules)
     moduleIds.sort()
-    
+
     for (var i=0; i<moduleIds.length; i++) {
         var moduleId = moduleIds[i]
-       
+
         writeModule(output, modules[moduleId], moduleId, debug)
     }
 
@@ -101,9 +96,9 @@ module.exports = function bundle(platform, debug, commitId, platformVersion, pla
     if (!scripts['bootstrap']) {
         throw new Error("didn't find a script for 'bootstrap'")
     }
-    
+
     writeScript(output, scripts['bootstrap'], debug)
-    
+
     var bootstrapPlatform = 'bootstrap-' + platform
     if (scripts[bootstrapPlatform]) {
         writeScript(output, scripts[bootstrapPlatform], debug)

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/tasks/lib/packager-browserify.js
----------------------------------------------------------------------
diff --git a/tasks/lib/packager-browserify.js b/tasks/lib/packager-browserify.js
index d26f35d..5bdb39a 100644
--- a/tasks/lib/packager-browserify.js
+++ b/tasks/lib/packager-browserify.js
@@ -19,6 +19,8 @@
 var fs                 = require('fs');
 var path               = require('path');
 var util               = require('util');
+var through            = require('through2');
+var requireTr          = require('./require-tr');
 var bundle             = require('./bundle-browserify');
 var computeCommitId    = require('./compute-commit-id');
 var writeLicenseHeader = require('./write-license-header');
@@ -43,7 +45,20 @@ module.exports = function generate(platform, useWindowsLineEndings, platformVers
 
         outReleaseFile = path.join('pkg', 'cordova.' + platform + '.js');
         outReleaseFileStream = fs.createWriteStream(outReleaseFile);
-        
+
+        var symbolList = null;
+        var addSymbolList = through.obj(function(row, enc, next) {
+            if(symbolList === null) {
+                symbolList = requireTr.getModules(platform);
+                this.push(util.format('var symbolList = %s;\n%s\n', JSON.stringify(symbolList, null, 4), row));
+            } else {
+                this.push(row);
+            }
+            next();
+        });
+
+        libraryRelease.pipeline.get('wrap').push(addSymbolList);
+
         // write license header
         writeLicenseHeader(outReleaseFileStream, platform, commitId, platformVersion);
 

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/tasks/lib/require-tr.js
----------------------------------------------------------------------
diff --git a/tasks/lib/require-tr.js b/tasks/lib/require-tr.js
index d287f79..a15f3ad 100644
--- a/tasks/lib/require-tr.js
+++ b/tasks/lib/require-tr.js
@@ -149,7 +149,10 @@ function _updateRequires(code, platform) {
            module.indexOf("cordova") === 0 && module.indexOf("cordova-") !== 0) {
 
           var scriptPath;
-          var cordovajssrc = path.join(process.cwd(), "platforms", platform, "platform_www", "cordova-js-src")
+          var cordovajssrc = path.join(process.cwd(), "platforms", platform, "platform_www", "cordova-js-src");
+          // Amazon uses "android" directory
+          var platformName = platform === "amazon-fireos" ? "android" : platform;
+          var platformModuleRe = new RegExp('cordova\/(' + platformName + ')\/(.+)');
 
           // require('cordova') -> cordova.js
           if(module === "cordova") {
@@ -158,17 +161,19 @@ function _updateRequires(code, platform) {
           }  else if(module.match(/cordova\/init/)) {
             scriptPath = node.args[0].value = module.replace(/cordova\/init/,
                                     path.join(root, "src", "common", "init_b"));
-          // android and amazon-fireos have some special require's
-          } else if(module.match(/cordova\/(android|amazon-fireos)\/(.+)/)) {
+          // handle platform's special special requires
+          } else if(module.match(platformModuleRe)) {
                 if(fs.existsSync(cordovajssrc)) {
                     //cordova cli project with cordova-js-src in platform
-                    scriptPath = node.args[0].value = module.replace(/cordova\/(android|amazon-fireos)\/(.+)/, path.join(cordovajssrc, "android", "$2"));
+                    scriptPath = node.args[0].value = module.replace(platformModuleRe,
+                        path.join(cordovajssrc, platformName, "$2"));
                 } else {
                     //non cli or no cordova-js-src directory
-                    scriptPath = node.args[0].value = module.replace(/cordova\/(android|amazon-fireos)\/(.+)/, path.join(root, "src", "legacy-exec", "$1", "android", "$2"));
+                    scriptPath = node.args[0].value = module.replace(platformModuleRe,
+                        path.join(root, "src", "legacy-exec", "$1", platformName, "$2"));
                 }
           // require('cordova/exec') and require('cordova/platform') -> platform's exec/platform
-          } else if(module.match(/cordova\/(platform|exec)$/)) {                
+          } else if(module.match(/cordova\/(platform|exec)$/)) {
                 if(fs.existsSync(cordovajssrc)) {
                     //cordova cli project with cordova-js-src in platform
                     scriptPath = node.args[0].value = module.replace(/cordova\/(platform|exec)/, path.join(cordovajssrc, "$1"));

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/tasks/lib/test-browser.js
----------------------------------------------------------------------
diff --git a/tasks/lib/test-browser.js b/tasks/lib/test-browser.js
index 01356a8..80c8fb2 100644
--- a/tasks/lib/test-browser.js
+++ b/tasks/lib/test-browser.js
@@ -23,15 +23,20 @@
 var fs       = require('fs');
 var path     = require('path');
 var connect  = require('connect');
-var exec     = require('child_process').exec;
 var bundle   = require('./bundle');
 var collect  = require('./collect');
+var start    = require('open');
+
+var testLibName    = path.join(__dirname, '..', '..', 'pkg', 'cordova.test.js');
+var testLib        = fs.readFileSync(testLibName, 'utf8');
 
 var pathToTemplate = path.join(__dirname, '..', 'templates', 'suite.html');
 var pathToVendor   = path.join(__dirname, '..', 'vendor');
 var pathToJasmine  = path.join(__dirname, '..', '..', 'node_modules', 'jasmine-node', 'lib', 'jasmine-node');
 var pathToTests    = path.join(__dirname, '..', '..', 'test');
 
+var SKIP_TESTS = false;
+
 var template = fs.readFileSync(pathToTemplate, "utf-8");
 
 // middlewar for GET '/cordova.test.js'
@@ -40,7 +45,7 @@ function cordovajs(req, res) {
         "Cache-Control": "no-cache",
         "Content-Type": "text/javascript"
     });
-    res.end(bundle('test'));
+    res.end(testLib);
 }
 
 // middleware for GET '/'
@@ -50,28 +55,34 @@ function root(req, res) {
         "Content-Type": "text/html"
     });
 
-    //FIXME in place collect thing is atrocious
-    //create the script tags to include
-    var tests = [];
-    collect(path.join(__dirname, '..', '..', 'test'), tests);
-    var specs = tests.map(function (file, path) {
-        return '<script src="' + file.replace(/^.*\/test\//, "/") +
-            '" type="text/javascript" charset="utf-8"></script>';
-    }).join('');
-
-    //inject in the test script includes and write the document
-    res.end(template.replace(/<!-- ##TESTS## -->/g, specs));
+    // When we testing browserify bundle, we don't need to include
+    // tests since they're already bundled with cordova.
+    if (!SKIP_TESTS) {
+        //FIXME in place collect thing is atrocious
+        //create the script tags to include
+        var tests = [];
+        collect(path.join(__dirname, '..', '..', 'test'), tests);
+        var specs = tests.map(function (file, path) {
+            return '<script src="' + file.replace(/\\/g, '/').replace(/^.*\/test\//, "/") +
+                '" type="text/javascript" charset="utf-8"></script>';
+        }).join('\n');
+
+        template = template.replace(/<!-- ##TESTS## -->/g, specs);
+    }
+
+    // write the document
+    res.end(template);
 }
 
 // connect router defn
 function routes(app) {
     app.get('/cordova.test.js', cordovajs);
-    app.get('/', root)
+    app.get('/', root);
 }
 
-module.exports = function() {
-
-    console.log('starting browser-based tests')
+module.exports = function(skipTests) {
+    SKIP_TESTS = skipTests;
+    console.log('starting browser-based tests');
 
     var vendor = connect.static(pathToVendor);
     var jasmine = connect.static(pathToJasmine);
@@ -79,10 +90,10 @@ module.exports = function() {
     var router = connect.router(routes);
 
     connect(vendor, jasmine, tests, router).listen(3000);
-    
+
     console.log("Test Server running on:\n");
     console.log("http://127.0.0.1:3000\n");
 
-    exec('open http://127.0.0.1:3000');
+    start('http://127.0.0.1:3000');
 };
 

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/tasks/lib/test-jsdom.js
----------------------------------------------------------------------
diff --git a/tasks/lib/test-jsdom.js b/tasks/lib/test-jsdom.js
index 5d3896e..f996f6c 100644
--- a/tasks/lib/test-jsdom.js
+++ b/tasks/lib/test-jsdom.js
@@ -30,7 +30,7 @@ var jsdom    = require("node-jsdom").jsdom;
 var document = jsdom(undefined, { url: 'file:///jsdomtest.info/a?b#c' });
 var window   = document.parentWindow;
 
-module.exports = function(callback) {
+module.exports = function(callback, skipTests) {
 
     console.log('starting node-based tests');
 
@@ -54,12 +54,16 @@ module.exports = function(callback) {
     // hijack require
     require = window.cordova.require;
     define  = window.cordova.define;
+    // Set up dummy navigator object
+    navigator = window.navigator || {};
 
-    // load in our tests
-    var tests = [];
-    collect(path.join(__dirname, '..', '..', 'test'), tests);
-    for (var x in tests) {
-        eval(fs.readFileSync(tests[x], "utf-8"));
+    if (!skipTests) {
+        // load in our tests
+        var tests = [];
+        collect(path.join(__dirname, '..', '..', 'test'), tests);
+        for (var x in tests) {
+            eval(fs.readFileSync(tests[x], "utf-8"));
+        }
     }
 
     var env = jasmine.getEnv();

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/tasks/templates/suite.html
----------------------------------------------------------------------
diff --git a/tasks/templates/suite.html b/tasks/templates/suite.html
index dd42955..7444a82 100644
--- a/tasks/templates/suite.html
+++ b/tasks/templates/suite.html
@@ -43,10 +43,6 @@
 
       window.global = window;
 
-      window.cordova = {
-         platform: ""
-      };
-
       window.addEventListener("load", function () {
           jasmineEnv.execute();
       });
@@ -62,7 +58,7 @@
   </script>
 
 	<!-- ##TESTS## -->
-	
+
 	<!-- Note: if you want to run individual tests, remove the tests placeholder above and include the individual tests yourself -->
 	<!-- <script src="test.accelerometer.js" type="text/javascript" charset="utf-8"></script> -->
 </head>

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/tasks/test.js
----------------------------------------------------------------------
diff --git a/tasks/test.js b/tasks/test.js
index 5e8306b..2714d93 100644
--- a/tasks/test.js
+++ b/tasks/test.js
@@ -26,11 +26,11 @@ try {
 module.exports = function(grunt) {
     grunt.registerTask('_test', 'Runs test in node', function() {
         var done = this.async();
-        require('./lib/test-jsdom')(done);
+        require('./lib/test-jsdom')(done, arguments[0] === ('skip-tests'));
     });
 
     grunt.registerTask('_btest', 'Runs tests in the browser', function() {
-        require('./lib/test-browser')();
+        require('./lib/test-browser')(arguments[0] === ('skip-tests'));
         this.async(); // never finish.
     });
 };

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/test/ios/test.exec.js
----------------------------------------------------------------------
diff --git a/test/ios/test.exec.js b/test/ios/test.exec.js
index 0f051f1..9b1d35a 100644
--- a/test/ios/test.exec.js
+++ b/test/ios/test.exec.js
@@ -19,6 +19,8 @@
  *
 */
 
+/*jshint jasmine:true*/
+
 describe('iOS exec', function () {
     var SERVICE = 'TestService';
     var ACTION = 'TestAction';
@@ -26,21 +28,26 @@ describe('iOS exec', function () {
 
     var cordova = require('cordova');
     var exec = require('cordova/ios/exec');
-    var mockxhr = require('cordova/mockxhr');
+    var mockxhr = require('cordova/test/mockxhr');
     var winSpy = jasmine.createSpy('win');
     var failSpy = jasmine.createSpy('fail');
+    var origUserAgent = navigator.userAgent;
 
     beforeEach(function() {
         winSpy.reset();
         failSpy.reset();
         mockxhr.install();
         exec.setJsToNativeBridgeMode(exec.jsToNativeModes.XHR_NO_PAYLOAD);
-        navigator = { userAgent: 'hi there (' + VC_ADDR + ')' };
+        navigator.__defineGetter__('userAgent', function(){
+            return 'hi there (' + VC_ADDR + ')';
+        });
     });
 
     afterEach(function() {
         expect(mockxhr.activeXhrs.length).toBe(0);
-        delete navigator;
+        navigator.__defineGetter__('userAgent', function(){
+            return origUserAgent;
+        });
     });
 
     afterEach(mockxhr.uninstall);

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c29e187/test/test.modulemapper.js
----------------------------------------------------------------------
diff --git a/test/test.modulemapper.js b/test/test.modulemapper.js
index d4c2806..2891099 100644
--- a/test/test.modulemapper.js
+++ b/test/test.modulemapper.js
@@ -20,7 +20,7 @@
 
 describe('modulemapper', function() {
     var modulemapper = require('cordova/modulemapper'),
-        testmodule = require('cordova/testmodule'),
+        testmodule = require('cordova/test/testmodule'),
         utils = require('cordova/utils');
     var context;
 
@@ -45,46 +45,46 @@ describe('modulemapper', function() {
         expect(function() { modulemapper.clobbers('cordova/invalid', 'newProp'); }).toThrow();
     });
     it('should properly set a new top-level property', function() {
-        modulemapper.clobbers('cordova/testmodule', 'newProp1');
-        modulemapper.defaults('cordova/testmodule', 'newProp2');
-        modulemapper.merges('cordova/testmodule', 'newProp3');
+        modulemapper.clobbers('cordova/test/testmodule', 'newProp1');
+        modulemapper.defaults('cordova/test/testmodule', 'newProp2');
+        modulemapper.merges('cordova/test/testmodule', 'newProp3');
         modulemapper.mapModules(context);
         expect(context.newProp1).toBe(testmodule);
         expect(context.newProp2).toBe(testmodule);
         expect(context.newProp3).toBe(testmodule);
     });
     it('should properly set a new non-top-level property', function() {
-        modulemapper.clobbers('cordova/testmodule', 'foo1.newProp');
-        modulemapper.defaults('cordova/testmodule', 'foo2.newProp');
-        modulemapper.merges('cordova/testmodule', 'foo3.newProp');
+        modulemapper.clobbers('cordova/test/testmodule', 'foo1.newProp');
+        modulemapper.defaults('cordova/test/testmodule', 'foo2.newProp');
+        modulemapper.merges('cordova/test/testmodule', 'foo3.newProp');
         modulemapper.mapModules(context);
         expect(context.foo1.newProp).toBe(testmodule);
         expect(context.foo2.newProp).toBe(testmodule);
         expect(context.foo3.newProp).toBe(testmodule);
     });
     it('should properly set a new non-top-level property #2', function() {
-        modulemapper.clobbers('cordova/testmodule', 'foo1.bar.newProp');
-        modulemapper.defaults('cordova/testmodule', 'foo2.bar.newProp');
-        modulemapper.merges('cordova/testmodule', 'foo3.bar.newProp');
+        modulemapper.clobbers('cordova/test/testmodule', 'foo1.bar.newProp');
+        modulemapper.defaults('cordova/test/testmodule', 'foo2.bar.newProp');
+        modulemapper.merges('cordova/test/testmodule', 'foo3.bar.newProp');
         modulemapper.mapModules(context);
         expect(context.foo1.bar.newProp).toBe(testmodule);
         expect(context.foo2.bar.newProp).toBe(testmodule);
         expect(context.foo3.bar.newProp).toBe(testmodule);
     });
     it('should properly set a non-new non-top-level property', function() {
-        modulemapper.clobbers('cordova/testmodule', 'obj.newProp1');
-        modulemapper.defaults('cordova/testmodule', 'obj.newProp2');
-        modulemapper.merges('cordova/testmodule', 'obj.newProp3');
+        modulemapper.clobbers('cordova/test/testmodule', 'obj.newProp1');
+        modulemapper.defaults('cordova/test/testmodule', 'obj.newProp2');
+        modulemapper.merges('cordova/test/testmodule', 'obj.newProp3');
         modulemapper.mapModules(context);
         expect(context.obj.newProp1).toBe(testmodule);
         expect(context.obj.newProp2).toBe(testmodule);
         expect(context.obj.newProp3).toBe(testmodule);
     });
     it('should clobber existing properties', function() {
-        modulemapper.clobbers('cordova/testmodule', 'num');
-        modulemapper.clobbers('cordova/testmodule', 'obj.str');
-        modulemapper.clobbers('cordova/testmodule', 'getme');
-        modulemapper.clobbers('cordova/testmodule', 'TestClass');
+        modulemapper.clobbers('cordova/test/testmodule', 'num');
+        modulemapper.clobbers('cordova/test/testmodule', 'obj.str');
+        modulemapper.clobbers('cordova/test/testmodule', 'getme');
+        modulemapper.clobbers('cordova/test/testmodule', 'TestClass');
         modulemapper.mapModules(context);
         expect(context.num).toBe(testmodule);
         expect(context.obj.str).toBe(testmodule);
@@ -92,10 +92,10 @@ describe('modulemapper', function() {
         expect(context.TestClass).toBe(testmodule);
     });
     it('should not clobber existing properties when using defaults', function() {
-        modulemapper.defaults('cordova/testmodule', 'num');
-        modulemapper.defaults('cordova/testmodule', 'obj.str');
-        modulemapper.defaults('cordova/testmodule', 'obj.getme');
-        modulemapper.defaults('cordova/testmodule', 'TestClass');
+        modulemapper.defaults('cordova/test/testmodule', 'num');
+        modulemapper.defaults('cordova/test/testmodule', 'obj.str');
+        modulemapper.defaults('cordova/test/testmodule', 'obj.getme');
+        modulemapper.defaults('cordova/test/testmodule', 'TestClass');
         modulemapper.mapModules(context);
         expect(context.num).not.toBe(testmodule);
         expect(context.obj.str).not.toBe(testmodule);
@@ -104,12 +104,12 @@ describe('modulemapper', function() {
     });
     it('should throw when namespace is a non-object', function() {
         expect(function() {
-            modulemapper.merges('cordova/testmodule', 'num');
+            modulemapper.merges('cordova/test/testmodule', 'num');
             modulemapper.mapModules(context);
         }).toThrow();
     });
     it('should merge into objects', function() {
-        modulemapper.merges('cordova/testmodule', 'obj');
+        modulemapper.merges('cordova/test/testmodule', 'obj');
         modulemapper.mapModules(context);
         for (var k in testmodule) {
             if (k != 'subObj') {
@@ -121,22 +121,22 @@ describe('modulemapper', function() {
         expect(context.obj.subObj.str).toBe(testmodule.subObj.str);
     });
     it('should merge into constructor prototypes', function() {
-        modulemapper.merges('cordova/testmodule', 'TestClass');
+        modulemapper.merges('cordova/test/testmodule', 'TestClass');
         modulemapper.mapModules(context);
         for (var k in testmodule) {
             expect(context.TestClass.prototype[k]).toBe(testmodule[k]);
         }
     });
     it('should maintain order of calls', function() {
-        modulemapper.merges('cordova/testmodule', 'obj');
-        modulemapper.clobbers('cordova/testmodule', 'obj');
+        modulemapper.merges('cordova/test/testmodule', 'obj');
+        modulemapper.clobbers('cordova/test/testmodule', 'obj');
         modulemapper.mapModules(context);
         expect(context.obj).toBe(testmodule);
     });
     it('should maintain order of calls2', function() {
-        modulemapper.merges('cordova/testmodule', 'obj.foo');
-        modulemapper.clobbers('cordova/testmodule', 'obj');
-        modulemapper.merges('cordova/testmodule', 'obj.obj');
+        modulemapper.merges('cordova/test/testmodule', 'obj.foo');
+        modulemapper.clobbers('cordova/test/testmodule', 'obj');
+        modulemapper.merges('cordova/test/testmodule', 'obj.obj');
         modulemapper.mapModules(context);
         expect(context.obj.foo).toBeUndefined();
         expect(context.obj).toBe(testmodule);
@@ -150,14 +150,14 @@ describe('modulemapper', function() {
     });
     it('should remember original symbols when clobbering', function() {
         var orig = context.obj;
-        modulemapper.clobbers('cordova/testmodule', 'obj');
+        modulemapper.clobbers('cordova/test/testmodule', 'obj');
         modulemapper.mapModules(context);
         expect(modulemapper.getOriginalSymbol(context, 'obj')).toBe(orig);
     });
     it('should remember original symbols when double clobbering', function() {
         var orig = context.obj;
-        modulemapper.clobbers('cordova/testmodule', 'obj');
-        modulemapper.clobbers('cordova/testmodule', 'obj');
+        modulemapper.clobbers('cordova/test/testmodule', 'obj');
+        modulemapper.clobbers('cordova/test/testmodule', 'obj');
         modulemapper.mapModules(context);
         expect(modulemapper.getOriginalSymbol(context, 'obj')).toBe(orig);
     });
@@ -172,8 +172,8 @@ describe('modulemapper', function() {
         this.after(function() {
             console.log = origConsoleLog;
         });
-        modulemapper.clobbers('cordova/testmodule', 'obj', 'Use foo instead');
-        modulemapper.defaults('cordova/testmodule', 'newProp', 'Use foo instead');
+        modulemapper.clobbers('cordova/test/testmodule', 'obj', 'Use foo instead');
+        modulemapper.defaults('cordova/test/testmodule', 'newProp', 'Use foo instead');
         modulemapper.mapModules(context);
         context.obj.func();
         context.obj.func();


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


Mime
View raw message