-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1802 from ajaykodali/fix/1769-asynchronous-error-…
…handling Fix for async hook error handling issue
- Loading branch information
Showing
12 changed files
with
529 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
describe('spec 1', function () { | ||
after(function (done) { | ||
console.log('after'); | ||
process.nextTick(function () { | ||
throw new Error('after hook error'); | ||
}); | ||
}); | ||
it('should be called because error is in after hook', function () { | ||
console.log('test 1'); | ||
}); | ||
it('should be called because error is in after hook', function () { | ||
console.log('test 2'); | ||
}); | ||
}); | ||
describe('spec 2', function () { | ||
it('should be called, because hook error was in a sibling suite', function () { | ||
console.log('test 3'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
describe('spec 1', function () { | ||
after(function () { | ||
console.log('after'); | ||
throw new Error('after hook error'); | ||
}); | ||
it('should be called because error is in after hook', function () { | ||
console.log('test 1'); | ||
}); | ||
it('should be called because error is in after hook', function () { | ||
console.log('test 2'); | ||
}); | ||
}); | ||
describe('spec 2', function () { | ||
it('should be called, because hook error was in a sibling suite', function () { | ||
console.log('test 3'); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
test/integration/fixtures/hooks/afterEach.hook.async.error.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
describe('spec 1', function () { | ||
afterEach(function (done) { | ||
console.log('after'); | ||
process.nextTick(function () { | ||
throw new Error('after each hook error'); | ||
}); | ||
}); | ||
it('should be called because error is in after each hook', function () { | ||
console.log('test 1'); | ||
}); | ||
it('should not be called', function () { | ||
console.log('test 2'); | ||
}); | ||
}); | ||
describe('spec 2', function () { | ||
it('should be called, because hook error was in a sibling suite', function () { | ||
console.log('test 3'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
describe('spec 1', function () { | ||
afterEach(function () { | ||
console.log('after'); | ||
throw new Error('after each hook error'); | ||
}); | ||
it('should be called because error is in after each hook', function () { | ||
console.log('test 1'); | ||
}); | ||
it('should not be called', function () { | ||
console.log('test 2'); | ||
}); | ||
}); | ||
describe('spec 2', function () { | ||
it('should be called, because hook error was in a sibling suite', function () { | ||
console.log('test 3'); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
test/integration/fixtures/hooks/before.hook.async.error.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
describe('spec 1', function () { | ||
before(function (done) { | ||
console.log('before'); | ||
process.nextTick(function () { | ||
throw new Error('before hook error'); | ||
}); | ||
}); | ||
it('should not be called because of error in before hook', function () { | ||
console.log('test 1'); | ||
}); | ||
it('should not be called because of error in before hook', function () { | ||
console.log('test 2'); | ||
}); | ||
}); | ||
describe('spec 2', function () { | ||
it('should be called, because hook error was in a sibling suite', function () { | ||
console.log('test 3'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
describe('spec 1', function () { | ||
before(function () { | ||
console.log('before'); | ||
throw new Error('before hook error'); | ||
}); | ||
it('should not be called because of error in before hook', function () { | ||
console.log('test 1'); | ||
}); | ||
it('should not be called because of error in before hook', function () { | ||
console.log('test 2'); | ||
}); | ||
}); | ||
describe('spec 2', function () { | ||
it('should be called, because hook error was in a sibling suite', function () { | ||
console.log('test 3'); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
test/integration/fixtures/hooks/beforeEach.hook.async.error.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
describe('spec 1', function () { | ||
beforeEach(function (done) { | ||
console.log('before'); | ||
process.nextTick(function () { | ||
throw new Error('before each hook error'); | ||
}); | ||
}); | ||
it('should not be called because of error in before each hook', function () { | ||
console.log('test 1'); | ||
}); | ||
it('should not be called because of error in before each hook', function () { | ||
console.log('test 2'); | ||
}); | ||
}); | ||
describe('spec 2', function () { | ||
it('should be called, because hook error was in a sibling suite', function () { | ||
console.log('test 3'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
describe('spec 1', function () { | ||
beforeEach(function () { | ||
console.log('before'); | ||
throw new Error('before each hook error'); | ||
}); | ||
it('should not be called because of error in before each hook', function () { | ||
console.log('test 1'); | ||
}); | ||
it('should not be called because of error in before each hook', function () { | ||
console.log('test 2'); | ||
}); | ||
}); | ||
describe('spec 2', function () { | ||
it('should be called, because hook error was in a sibling suite', function () { | ||
console.log('test 3'); | ||
}); | ||
}); |
139 changes: 139 additions & 0 deletions
139
test/integration/fixtures/hooks/multiple.hook.async.error.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
before(function () { | ||
console.log('root before'); | ||
}); | ||
beforeEach(function () { | ||
console.log('root before each'); | ||
}); | ||
describe('1', function () { | ||
beforeEach(function () { | ||
console.log('1 before each'); | ||
}); | ||
|
||
describe('1.1', function () { | ||
before(function () { | ||
console.log('1.1 before'); | ||
}); | ||
beforeEach(function (done) { | ||
console.log('1.1 before each'); | ||
process.nextTick(function () { | ||
throw new Error('1.1 before each hook failed'); | ||
}); | ||
}); | ||
it('1.1 test 1', function () { | ||
console.log('1.1 test 1'); | ||
}); | ||
it('1.1 test 2', function () { | ||
console.log('1.1 test 2'); | ||
}); | ||
afterEach(function () { | ||
console.log('1.1 after each'); | ||
}); | ||
after(function (done) { | ||
console.log('1.1 after'); | ||
process.nextTick(function () { | ||
throw new Error('1.1 after hook failed'); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('1.2', function () { | ||
before(function () { | ||
console.log('1.2 before'); | ||
}); | ||
beforeEach(function () { | ||
console.log('1.2 before each'); | ||
}); | ||
it('1.2 test 1', function () { | ||
console.log('1.2 test 1'); | ||
}); | ||
it('1.2 test 2', function () { | ||
console.log('1.2 test 2'); | ||
}); | ||
afterEach(function (done) { | ||
console.log('1.2 after each'); | ||
process.nextTick(function () { | ||
throw new Error('1.2 after each hook failed'); | ||
}); | ||
}); | ||
after(function () { | ||
console.log('1.2 after'); | ||
}); | ||
}); | ||
|
||
afterEach(function () { | ||
console.log('1 after each'); | ||
}); | ||
|
||
after(function () { | ||
console.log('1 after'); | ||
}); | ||
}); | ||
|
||
describe('2', function () { | ||
beforeEach(function (done) { | ||
console.log('2 before each'); | ||
process.nextTick(function () { | ||
throw new Error('2 before each hook failed'); | ||
}); | ||
}); | ||
|
||
describe('2.1', function () { | ||
before(function () { | ||
console.log('2.1 before'); | ||
}); | ||
beforeEach(function () { | ||
console.log('2.1 before each'); | ||
}); | ||
it('2.1 test 1', function () { | ||
console.log('2.1 test 1'); | ||
}); | ||
it('2.1 test 2', function () { | ||
console.log('2.1 test 2'); | ||
}); | ||
afterEach(function () { | ||
console.log('2.1 after each'); | ||
}); | ||
after(function () { | ||
console.log('2.1 after'); | ||
}); | ||
}); | ||
|
||
describe('2.2', function () { | ||
before(function () { | ||
console.log('2.2 before'); | ||
}); | ||
beforeEach(function () { | ||
console.log('2.2 before each'); | ||
}); | ||
it('2.2 test 1', function () { | ||
console.log('2.2 test 1'); | ||
}); | ||
it('2.2 test 2', function () { | ||
console.log('2.2 test 2'); | ||
}); | ||
afterEach(function () { | ||
console.log('2.2 after each'); | ||
}); | ||
after(function () { | ||
console.log('2.2 after'); | ||
}); | ||
}); | ||
|
||
afterEach(function (done) { | ||
console.log('2 after each'); | ||
process.nextTick(function () { | ||
throw new Error('2 after each hook failed'); | ||
}); | ||
}); | ||
|
||
after(function () { | ||
console.log('2 after'); | ||
}); | ||
}); | ||
|
||
after(function () { | ||
console.log('root after'); | ||
}); | ||
afterEach(function () { | ||
console.log('root after each'); | ||
}); |
Oops, something went wrong.