From fd162efb912d058909099cdc9f37ececb33d362a Mon Sep 17 00:00:00 2001 From: Michael Krotscheck Date: Mon, 16 May 2016 10:01:05 -0700 Subject: [PATCH] Using the --non-interactive flag now force-overwrites files. If a user applies this flag, no tty input should be required. This ensures that it works as expected. Change-Id: I20d00295f7164eec2442f45c91e9f1150bc605a0 --- generators/app/index.js | 3 +++ spec/app/index.js | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/generators/app/index.js b/generators/app/index.js index 1c63736..a135406 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -19,6 +19,9 @@ // Add support for a `--non-interactive` flag this.option('non-interactive'); + + // If non-interactive is set, force-override all files. + this.conflicter.force = this.options['non-interactive']; }, initializing: function () { diff --git a/spec/app/index.js b/spec/app/index.js index e0173c5..aa74faa 100644 --- a/spec/app/index.js +++ b/spec/app/index.js @@ -25,6 +25,7 @@ }); helpers.run(generator) + .withArguments(['--non-interactive']) .on('end', function () { spies.forEach(function (spy) { expect(spy.calls.any()).toBeTruthy(); @@ -34,6 +35,18 @@ }); }); + it('should force overwrite if --non-interactive is set.', + function (done) { + helpers.run(generator) + .withArguments(['--non-interactive']) + .on('ready', function (generator) { + expect(generator.conflicter.force).toBeTruthy(); + }) + .on('end', function () { + done(); + }); + }); + describe('writing()', function () { it('should create all files created in the project builder', function (done) {