Skip to content

Commit

Permalink
fix(ui): default exitOnError to true in listr opts
Browse files Browse the repository at this point in the history
  • Loading branch information
acburdine committed Oct 11, 2018
1 parent c81070c commit 58806da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion lib/ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ class UI {
*/
listr(tasks, context, options) {
const listrOpts = Object.assign({
renderer: this.verbose ? 'verbose' : this.Renderer
renderer: this.verbose ? 'verbose' : this.Renderer,
exitOnError: true
}, options || {});

const listr = new Listr(tasks, listrOpts);
Expand Down
13 changes: 7 additions & 6 deletions test/unit/ui/index-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,9 @@ describe('Unit: UI', function () {
expect(ListrStub.calledWithNew()).to.be.true;
expect(createRendererStub.calledOnce).to.be.true;
expect(ListrStub.calledWithExactly(tasks, {
renderer: {RendererClass: true}
}));
renderer: {RendererClass: true},
exitOnError: true
})).to.be.true;
expect(runStub.calledOnce).to.be.true;
expect(runStub.calledWithExactly({
ui: ui,
Expand All @@ -419,8 +420,8 @@ describe('Unit: UI', function () {
expect(createRendererStub.called).to.be.false;
expect(ListrStub.calledWithExactly(tasks, {
renderer: 'verbose',
exitOnError: true
}));
exitOnError: false
})).to.be.true;
expect(runStub.calledOnce).to.be.true;
expect(runStub.calledWithExactly({
something: 'foo',
Expand All @@ -437,13 +438,13 @@ describe('Unit: UI', function () {
const ui = new UI();
const tasks = ['test','ing','is','necessary'];

const result = ui.listr(tasks, false, {exitOnError: false, renderer: 'update'});
const result = ui.listr(tasks, false, {renderer: 'update'});
expect(result).to.deep.equal({run: runStub});
expect(ListrStub.calledWithNew()).to.be.true;
expect(ListrStub.calledWithExactly(tasks, {
renderer: 'update',
exitOnError: true
}));
})).to.be.true;
expect(runStub.called).to.be.false;
});
});
Expand Down

0 comments on commit 58806da

Please sign in to comment.