Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CB5EC102C4 for ; Tue, 15 Apr 2014 00:33:08 +0000 (UTC) Received: (qmail 14378 invoked by uid 500); 15 Apr 2014 00:33:06 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 14305 invoked by uid 500); 15 Apr 2014 00:33:05 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 14143 invoked by uid 99); 15 Apr 2014 00:33:03 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Apr 2014 00:33:03 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 4819398DC72; Tue, 15 Apr 2014 00:33:02 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kamrik@apache.org To: commits@cordova.apache.org Date: Tue, 15 Apr 2014 00:33:08 -0000 Message-Id: <9e3c81ecf9ee4a449f14e10ac270917a@git.apache.org> In-Reply-To: <372739a441ce406dbe3c0907f08efb1a@git.apache.org> References: <372739a441ce406dbe3c0907f08efb1a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [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 Authored: Wed Apr 9 15:23:48 2014 -0400 Committer: Mark Koudritsky 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});