CB-13492 : updating opts.save and including a tests for no-save
diff --git a/index.js b/index.js
index 4284ad4..d17d6c3 100644
--- a/index.js
+++ b/index.js
@@ -276,6 +276,8 @@
// 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
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 @@
})
.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);
+ });
});