Skip to afterEach fns when a beforeEach fn errors

* #1533
This commit is contained in:
Steve Gravrock
2021-09-29 12:35:00 -07:00
parent a1f14efac6
commit 457a2727ba
3 changed files with 8 additions and 12 deletions

View File

@@ -1610,7 +1610,7 @@ getJasmineRequireObj().Env = function(j$) {
var queueRunnerFactory = function(options, args) {
var failFast = false;
if (options.isLeaf) {
failFast = config.stopSpecOnExpectationFailure;
failFast = true;
} else if (!options.isReporter) {
failFast = config.stopOnSpecFailure;
}

View File

@@ -983,7 +983,7 @@ describe('spec running', function() {
});
describe('When stopSpecOnExpectationFailure is false', function() {
it('does not skip anything after a thrown error', async function() {
it('skips to cleanup functions after a thrown error', async function() {
var actions = [];
env.describe('Something', function() {
@@ -1015,14 +1015,12 @@ describe('spec running', function() {
expect(actions).toEqual([
'outer beforeEach',
'inner beforeEach',
'inner it',
'inner afterEach',
'outer afterEach'
]);
});
it('does not skip anything after a rejected promise', async function() {
it('skips to cleanup functions after a rejected promise', async function() {
var actions = [];
env.describe('Something', function() {
@@ -1054,8 +1052,6 @@ describe('spec running', function() {
expect(actions).toEqual([
'outer beforeEach',
'inner beforeEach',
'inner it',
'inner afterEach',
'outer afterEach'
]);
@@ -1100,7 +1096,7 @@ describe('spec running', function() {
]);
});
it('does not skip anything after done.fail is called', async function() {
it('skips to cleanup functions after done.fail is called', async function() {
var actions = [];
env.describe('Something', function() {
@@ -1120,10 +1116,10 @@ describe('spec running', function() {
await env.execute();
expect(actions).toEqual(['beforeEach', 'it', 'afterEach']);
expect(actions).toEqual(['beforeEach', 'afterEach']);
});
it('does not skip anything when an async function times out', async function() {
it('skips to cleanup functions when an async function times out', async function() {
var actions = [];
env.describe('Something', function() {
@@ -1142,7 +1138,7 @@ describe('spec running', function() {
await env.execute();
expect(actions).toEqual(['beforeEach', 'it', 'afterEach']);
expect(actions).toEqual(['beforeEach', 'afterEach']);
});
it('runs all reporter callbacks even if one fails', async function() {

View File

@@ -504,7 +504,7 @@ getJasmineRequireObj().Env = function(j$) {
var queueRunnerFactory = function(options, args) {
var failFast = false;
if (options.isLeaf) {
failFast = config.stopSpecOnExpectationFailure;
failFast = true;
} else if (!options.isReporter) {
failFast = config.stopOnSpecFailure;
}