Updated Branches: refs/heads/cordova-client ed8721f5e -> 5854abda3
sped up tests by catching calls to android/bin/create at the child_process.exec level. gnarly, but saves test run time by about 50% on my machine Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/commit/5854abda Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/tree/5854abda Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/diff/5854abda Branch: refs/heads/cordova-client Commit: 5854abda37907a93dd16ccd8267ffe6feeb07970 Parents: ed8721f Author: Fil Maj <maj....@gmail.com> Authored: Sat Sep 22 19:10:22 2012 -0700 Committer: Fil Maj <maj....@gmail.com> Committed: Sat Sep 22 19:10:22 2012 -0700 ---------------------------------------------------------------------- spec/build.spec.js | 6 +++--- spec/helper.js | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/5854abda/spec/build.spec.js ---------------------------------------------------------------------- diff --git a/spec/build.spec.js b/spec/build.spec.js index 3346ca1..cd8ee9e 100644 --- a/spec/build.spec.js +++ b/spec/build.spec.js @@ -62,7 +62,7 @@ describe('build command', function() { cordova.build(); }).toThrow(); }); - describe('should shell out to the debug command and create a binary', function() { + describe('binary creation', function() { beforeEach(function() { cordova.create(tempDir); process.chdir(tempDir); @@ -71,7 +71,7 @@ describe('build command', function() { afterEach(function() { process.chdir(cwd); }); - it('on Android', function() { + it('should shell out to debug command on Android', function() { var buildcb = jasmine.createSpy(); var cb = jasmine.createSpy(); @@ -94,7 +94,7 @@ describe('build command', function() { }).length > 0).toBe(true); }); }); - it('on iOS', function() { + it('should shelll out to debug command on iOS', function() { var buildcb = jasmine.createSpy(); var cb = jasmine.createSpy(); http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/5854abda/spec/helper.js ---------------------------------------------------------------------- diff --git a/spec/helper.js b/spec/helper.js index ce6a952..9baa536 100644 --- a/spec/helper.js +++ b/spec/helper.js @@ -1 +1,24 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; + +var cp = require('child_process'), + path = require('path'), + fs = require('fs'), + android_project = path.join(__dirname, 'fixtures', 'projects', 'native', 'android'), + wrench = require('wrench'), + cpr = wrench.copyDirSyncRecursive; + +var orig_exec = cp.exec; + +cp.exec = function(cmd, cb) { + // Match various commands to exec + if (cmd.match(/android.bin.create/)) { + var r = new RegExp(/android.bin.create"\s"([\/\\\w-_\.]*)"/); + var dir = r.exec(cmd)[1]; + cpr(android_project, dir); + fs.chmodSync(path.join(dir, 'cordova', 'debug'), '754'); + cb(); + return; + } + // Fire off to original exec + orig_exec.apply(null, arguments); +}