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
This commit is contained in:
Michael Krotscheck
2016-05-16 10:01:05 -07:00
parent e0cd8e4f86
commit fd162efb91
2 changed files with 16 additions and 0 deletions

View File

@@ -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 () {

View File

@@ -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) {