You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ka...@apache.org on 2014/04/15 02:33:08 UTC
[8/8] git commit: CB-6421: Move tests from e2e to spec - cli test
CB-6421: Move tests from e2e to spec - cli test
After e2e dir was merged into spec/ there were interferences between the e2e
tests and cli.spec.js. Jasmine runs all tests in a single process, therefore
process-global settings like event listener (un)registration can cause
interference between the tests.
github: close #159
Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/38db7a2d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/38db7a2d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/38db7a2d
Branch: refs/heads/master
Commit: 38db7a2db44fbb251df3af1567699df3b1a3ec1e
Parents: f4a9597
Author: Mark Koudritsky <ka...@gmail.com>
Authored: Wed Apr 9 15:23:48 2014 -0400
Committer: Mark Koudritsky <ka...@gmail.com>
Committed: Mon Apr 14 20:28:17 2014 -0400
----------------------------------------------------------------------
package.json | 2 +-
spec/cli.spec.js | 18 ++++++++++--------
2 files changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/38db7a2d/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 87d2eb1..ae02211 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,7 @@
"cordova": "./bin/cordova"
},
"scripts": {
- "test": "jasmine-node --color spec e2e"
+ "test": "jasmine-node --color spec"
},
"repository": {
"type": "git",
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/38db7a2d/spec/cli.spec.js
----------------------------------------------------------------------
diff --git a/spec/cli.spec.js b/spec/cli.spec.js
index 835e8eb..c09042d 100644
--- a/spec/cli.spec.js
+++ b/spec/cli.spec.js
@@ -16,11 +16,21 @@
specific language governing permissions and limitations
under the License.
*/
+
var CLI = require("../src/cli"),
Q = require('q'),
+ plugman = require('plugman'),
cordova = require("../cordova");
describe("cordova cli", function () {
+ beforeEach(function () {
+ // Event registration is currently process-global. Since all jasmine
+ // tests in a directory run in a single process (and in parallel),
+ // logging events registered as a result of the "--verbose" flag in
+ // CLI testing below would cause lots of logging messages printed out by other specs.
+ spyOn(cordova, "on");
+ spyOn(plugman, "on");
+ });
describe("options", function () {
describe("version", function () {
@@ -51,10 +61,6 @@ describe("cordova cli", function () {
spyOn(cordova.raw, "build").andReturn(Q());
});
- afterEach(function () {
- cordova.removeAllListeners();
- });
-
it("will call command with all arguments passed through", function () {
new CLI(["node", "cordova", "build", "blackberry10", "-k", "abcd1234"]);
expect(cordova.raw.build).toHaveBeenCalledWith({verbose: false, silent: false, platforms: ["blackberry10"], options: ["-k", "abcd1234"]});
@@ -91,10 +97,6 @@ describe("cordova cli", function () {
spyOn(cordova.raw, "plugin").andReturn(Q());
});
- afterEach(function () {
- cordova.removeAllListeners();
- });
-
it("will call command with all arguments passed through", function () {
new CLI(["node", "cordova", "plugin", "add", "facebook", "--variable", "FOO=foo"]);
expect(cordova.raw.plugin).toHaveBeenCalledWith("add", ["facebook", "--variable", "FOO=foo"], {searchpath: undefined});