cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From audre...@apache.org
Subject [2/6] cordova-fetch git commit: CB-13492 : updating opts.save and including a tests for no-save
Date Fri, 27 Oct 2017 23:12:50 GMT
CB-13492 : updating opts.save and including a tests for no-save


Project: http://git-wip-us.apache.org/repos/asf/cordova-fetch/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-fetch/commit/fa85026e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-fetch/tree/fa85026e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-fetch/diff/fa85026e

Branch: refs/heads/1.2.x
Commit: fa85026e23f9f3cfd31608f17ef9e59505b0807e
Parents: 4c27340
Author: Audrey So <audreyso@apache.org>
Authored: Wed Oct 25 14:19:31 2017 -0700
Committer: Audrey So <audreyso@apache.org>
Committed: Wed Oct 25 14:44:03 2017 -0700

----------------------------------------------------------------------
 index.js                |  2 ++
 spec/fetch-unit.spec.js | 13 +++++++++++++
 2 files changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-fetch/blob/fa85026e/index.js
----------------------------------------------------------------------
diff --git a/index.js b/index.js
index 4284ad4..d17d6c3 100644
--- a/index.js
+++ b/index.js
@@ -276,6 +276,8 @@ module.exports.uninstall = function (target, dest, opts) {
             // if user added --save flag, pass it to npm uninstall command
             if (opts.save) {
                 fetchArgs.push('--save');
+            } else {
+                fetchArgs.push('--no-save');
             }
 
             // run npm uninstall, this will remove dependency

http://git-wip-us.apache.org/repos/asf/cordova-fetch/blob/fa85026e/spec/fetch-unit.spec.js
----------------------------------------------------------------------
diff --git a/spec/fetch-unit.spec.js b/spec/fetch-unit.spec.js
index a8c206d..c13f75a 100644
--- a/spec/fetch-unit.spec.js
+++ b/spec/fetch-unit.spec.js
@@ -70,4 +70,17 @@ describe('unit tests for index.js', function () {
             })
             .fin(done);
     });
+
+    it('when save is false, no-save flag should be passed through', function (done) {
+        var opts = { cwd: 'some/path', production: true, save: false};
+        fetch('platform', 'tmpDir', opts)
+            .then(function (result) {
+                expect(superspawn.spawn).toHaveBeenCalledWith('npm', jasmine.stringMatching(/--no-save/),
jasmine.any(Object));
+            })
+            .fail(function (err) {
+                console.error(err);
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
+    });
 });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message