Skip to content

Commit

Permalink
Skip instead of abort
Browse files Browse the repository at this point in the history
  • Loading branch information
geek committed Jan 18, 2017
1 parent c074671 commit ae23bc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
15 changes: 1 addition & 14 deletions lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,6 @@ internals.executeExperiments = function (experiments, state, skip, callback) {
state.report.errors.push(err);
}

if (state.report.errors.length && state.options.bail === true) {
return callback();
}

nextExperiment();
});
},
Expand Down Expand Up @@ -361,10 +357,6 @@ internals.executeTests = function (experiment, state, skip, callback) {
return callback();
}

// Set to an error when options.bail is set and a test fails

let bail = null;

// Collect beforeEach and afterEach from parents

const befores = skip ? [] : internals.collectDeps(experiment, 'beforeEaches');
Expand Down Expand Up @@ -398,7 +390,7 @@ internals.executeTests = function (experiment, state, skip, callback) {
return nextTest();
}

const skipTest = skip || test.options.skip;
const skipTest = skip || test.options.skip || (state.options.bail && state.report.failures);

const steps = [
function (next) {
Expand Down Expand Up @@ -439,7 +431,6 @@ internals.executeTests = function (experiment, state, skip, callback) {
state.report.failures++;
test.err = err;
test.timeout = err.timeout;
bail = state.options.bail === true ? err : null;
}

test.duration = Date.now() - start;
Expand Down Expand Up @@ -472,10 +463,6 @@ internals.executeTests = function (experiment, state, skip, callback) {
state.report.errors.push(err);
}

if (bail) {
return callback(bail);
}

return nextTest();
});
};
Expand Down
5 changes: 3 additions & 2 deletions test/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -810,9 +810,10 @@ describe('Runner', () => {
Lab.execute(script, { bail: true }, null, (err, notebook) => {

expect(err).not.to.exist();
expect(notebook.tests).to.have.length(2);
expect(notebook.tests).to.have.length(3);
expect(notebook.failures).to.equal(1);
expect(notebook.errors[0].message).to.contain('bailing');
expect(notebook.tests[1].err.message).to.contain('bailing');
expect(notebook.tests[2].skipped).to.be.true();
done();
});
});
Expand Down

0 comments on commit ae23bc4

Please sign in to comment.