From 6418add83d048cf7e2ff7a1a9f723fea41abfe72 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Thu, 6 Oct 2016 14:45:26 -0700 Subject: [PATCH] Did a try/catch to deal with the unit tests vs actual project environment, code duplication is needed because of builderEnv --- bin/templates/cordova/Api.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/bin/templates/cordova/Api.js b/bin/templates/cordova/Api.js index 74549fe6..b7411dcc 100644 --- a/bin/templates/cordova/Api.js +++ b/bin/templates/cordova/Api.js @@ -354,13 +354,24 @@ Api.prototype.run = function(runOptions) { */ Api.prototype.clean = function(cleanOptions) { var self = this; + try { return require('./lib/check_reqs').run() - .then(function () { - return require('./lib/build').runClean.call(self, cleanOptions); - }) - .then(function () { - return require('./lib/prepare').clean.call(self, cleanOptions); - }); + .then(function () { + return require('./lib/build').runClean.call(self, cleanOptions); + }) + .then(function () { + return require('./lib/prepare').clean.call(self, cleanOptions); + }); + } + catch (err) { + return require('../../lib/check_reqs').run() + .then(function () { + return require('./lib/build').runClean.call(self, cleanOptions); + }) + .then(function () { + return require('./lib/prepare').clean.call(self, cleanOptions); + }); + } }; /**