forked from mochajs/mocha
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(re-)enable after each hooks to fail tests.
In version 1.2.1, support was added to fail test in the after each hook: >* Added `this.test.error(err)` support to after each hooks. Closes mochajs#287 While migrating from teaspoon-mocha to karma-mocha, we discovered that in the current mocha version this isn't supported anymore. That behaviour has been changed in: ebc6aee without any documentation change. If this was a conscious decision adding some documentation about dropping this functionality would then be nice. The old behaviour is documented in: https://github.com/mochajs/mocha/wiki/Conditionally-failing-tests-in-afterEach()-hooks .
- Loading branch information
Showing
4 changed files
with
51 additions
and
15 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,16 @@ | ||
describe('spec 1', function () { | ||
afterEach(function () { | ||
this.test.error(new Error('something went wrong')); | ||
}); | ||
it('should be set to failure in the afterEach', function () { | ||
console.log('test 1'); | ||
}); | ||
it('should be set to failure in the afterEach', function () { | ||
console.log('test 2'); | ||
}); | ||
}); | ||
describe('spec 2', function () { | ||
it('should succeed', 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
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