You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/01/31 23:03:46 UTC
[6/10] git commit: more work for making tests fast
more work for making tests fast
Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/32dcdc7b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/32dcdc7b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/32dcdc7b
Branch: refs/heads/master
Commit: 32dcdc7b91ea338d97d9a699d371e2f564416762
Parents: 6c74e7f
Author: Fil Maj <ma...@gmail.com>
Authored: Thu Jan 31 10:57:13 2013 -0800
Committer: Fil Maj <ma...@gmail.com>
Committed: Thu Jan 31 10:57:13 2013 -0800
----------------------------------------------------------------------
spec/build.spec.js | 45 ++++++--------------------
spec/emulate.spec.js | 3 +-
spec/metadata/blackberry_parser.spec.js | 7 ++--
spec/plugin.spec.js | 3 +-
spec/serve.spec.js | 2 +-
src/build.js | 3 +-
6 files changed, 18 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/32dcdc7b/spec/build.spec.js
----------------------------------------------------------------------
diff --git a/spec/build.spec.js b/spec/build.spec.js
index 0eeef59..7aedec2 100644
--- a/spec/build.spec.js
+++ b/spec/build.spec.js
@@ -28,12 +28,13 @@ var cordova = require('../cordova'),
hooker = require('../src/hooker'),
fixtures = path.join(__dirname, 'fixtures'),
hooks = path.join(fixtures, 'hooks'),
- tempDir = path.join(__dirname, '..', 'temp');
+ tempDir = path.join(__dirname, '..', 'temp'),
+ cordova_project = path.join(fixtures, 'projects', 'cordova');
var cwd = process.cwd();
shell.rm('-rf', tempDir);
-describe('build command', function() {
+xdescribe('build command', function() {
afterEach(function() {
shell.rm('-rf', tempDir);
});
@@ -55,40 +56,14 @@ describe('build command', function() {
process.chdir(cwd);
});
- var buildcb = jasmine.createSpy();
-
- cordova.create(tempDir);
- process.chdir(tempDir);
- cordova.platform('add', 'android');
+ process.chdir(cordova_project);
var s = spyOn(require('shelljs'), 'exec').andReturn({code:0});
+ spyOn(android_parser.prototype, 'update_project');
expect(function() {
- cordova.build(buildcb);
+ cordova.build();
+ expect(s).toHaveBeenCalled();
}).not.toThrow();
- expect(s).toHaveBeenCalled();
- });
- xit('should run inside a directory with a space', function() {
- var spaceDir = path.join(__dirname, '..', 'foo proj');
- var cb = jasmine.createSpy();
- var buildcb = jasmine.createSpy();
- this.after(function() {
- process.chdir(cwd);
- shell.rm('-rf', spaceDir);
- });
-
- runs(function() {
- cordova.create(spaceDir);
- process.chdir(spaceDir);
- cordova.platform('add', 'ios', cb);
- });
- waitsFor(function() { return cb.wasCalled; }, 'ios create');
-
- runs(function() {
- expect(function() {
- cordova.build(buildcb);
- }).not.toThrow();
- });
- waitsFor(function() { return buildcb.wasCalled; }, 'ios build');
});
it('should not run outside of a Cordova-based project', function() {
this.after(function() {
@@ -102,7 +77,7 @@ describe('build command', function() {
cordova.build();
}).toThrow();
});
- describe('per platform', function() {
+ xdescribe('per platform', function() {
beforeEach(function() {
cordova.create(tempDir);
process.chdir(tempDir);
@@ -206,7 +181,7 @@ describe('build command', function() {
});
});
- describe('specifying platforms to build', function() {
+ xdescribe('specifying platforms to build', function() {
beforeEach(function() {
cordova.create(tempDir);
process.chdir(tempDir);
@@ -276,7 +251,7 @@ describe('build command', function() {
});
});
- describe('hooks', function() {
+ xdescribe('hooks', function() {
var s;
beforeEach(function() {
cordova.create(tempDir);
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/32dcdc7b/spec/emulate.spec.js
----------------------------------------------------------------------
diff --git a/spec/emulate.spec.js b/spec/emulate.spec.js
index f206a1d..a936e1e 100644
--- a/spec/emulate.spec.js
+++ b/spec/emulate.spec.js
@@ -1,4 +1,3 @@
-
/**
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -31,7 +30,7 @@ var cordova = require('../cordova'),
var cwd = process.cwd();
-describe('emulate command', function() {
+xdescribe('emulate command', function() {
beforeEach(function() {
// Make a temp directory
shell.rm('-rf', tempDir);
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/32dcdc7b/spec/metadata/blackberry_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/blackberry_parser.spec.js b/spec/metadata/blackberry_parser.spec.js
index c6315ec..6102753 100644
--- a/spec/metadata/blackberry_parser.spec.js
+++ b/spec/metadata/blackberry_parser.spec.js
@@ -153,6 +153,7 @@ describe('blackberry project parser', function() {
describe('update_project method', function() {
var cordova_config_path = path.join(project_path, '.cordova', 'config.json');
var original_config_json = fs.readFileSync(cordova_config_path, 'utf-8');
+
describe('with stubbed out config for BlackBerry SDKs', function() {
beforeEach(function() {
fs.writeFileSync(cordova_config_path, JSON.stringify({
@@ -188,6 +189,9 @@ describe('blackberry project parser', function() {
});
});
describe('with empty BlackBerry SDKs in config', function() {
+ afterEach(function() {
+ fs.writeFileSync(cordova_config_path, original_config_json, 'utf-8');
+ });
it('should invoke get_blackberry_environment', function() {
var spyEnv = spyOn(parser, 'get_blackberry_environment');
var promptSpy = spyOn(require('prompt'), 'get');
@@ -195,9 +199,6 @@ describe('blackberry project parser', function() {
expect(spyEnv).toHaveBeenCalled();
});
it('should write out project properties', function(done) {
- this.after(function() {
- fs.writeFileSync(cordova_config_path, original_config_json, 'utf-8');
- });
var spyProps = spyOn(parser, 'write_project_properties');
var promptSpy = spyOn(require('prompt'), 'get');
parser.update_project(config, function() {
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/32dcdc7b/spec/plugin.spec.js
----------------------------------------------------------------------
diff --git a/spec/plugin.spec.js b/spec/plugin.spec.js
index 2330de1..43fbecb 100644
--- a/spec/plugin.spec.js
+++ b/spec/plugin.spec.js
@@ -1,4 +1,3 @@
-
/**
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -29,7 +28,7 @@ var cordova = require('../cordova'),
var cwd = process.cwd();
-describe('plugin command', function() {
+xdescribe('plugin command', function() {
beforeEach(function() {
// Make a temp directory
shell.rm('-rf', tempDir);
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/32dcdc7b/spec/serve.spec.js
----------------------------------------------------------------------
diff --git a/spec/serve.spec.js b/spec/serve.spec.js
index 1f527fe..8d00cab 100644
--- a/spec/serve.spec.js
+++ b/spec/serve.spec.js
@@ -32,7 +32,7 @@ var cordova = require('../cordova'),
var cwd = process.cwd();
-describe('serve command', function() {
+xdescribe('serve command', function() {
beforeEach(function() {
// Make a temp directory
shell.rm('-rf', tempDir);
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/32dcdc7b/src/build.js
----------------------------------------------------------------------
diff --git a/src/build.js b/src/build.js
index 3f64559..19af147 100644
--- a/src/build.js
+++ b/src/build.js
@@ -1,4 +1,3 @@
-
/**
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -20,7 +19,7 @@
var cordova_util = require('./util'),
path = require('path'),
config_parser = require('./config_parser'),
- platform = require('./platform'),
+ platform = require('./platform'),
fs = require('fs'),
shell = require('shelljs'),
ls = fs.readdirSync,