-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add failing test: after hook is not run if test skipped in beforeEach #2287
Changes from all commits
2c9966c
22dbad7
4f2e454
d2ba7a9
d165c82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
var assert = require('assert'); | ||
var assert = require('assert'); | ||
var fs = require('fs'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did this... pick up a UTF-8 BOM or something? I will see if I can fix that when I get another free moment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or not, if it's already merged into the history and isn't hurting anything... |
||
var path = require('path'); | ||
var run = require('./helpers').runMocha; | ||
|
@@ -50,4 +50,16 @@ describe('regressions', function() { | |
done(); | ||
}); | ||
}) | ||
|
||
describe('issue-2286: after doesn\'t execute if test was skipped in beforeEach', function () { | ||
var afterWasRun = false; | ||
describe('suite with skipped test for meta test', function () { | ||
beforeEach(function () { this.skip(); }); | ||
after(function () { afterWasRun = true; }); | ||
it('should be pending', function () {}); | ||
}) | ||
after('meta test', function () { | ||
afterWasRun.should.be.ok(); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't it use
suite.pending
if it's notbeforeEach
orafterEach
? Or in the older versions doesafter
run even ifbefore
calls this.skip()?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setting the suite to be pending, at this point, will cause the
after
hook to not get executed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(so, the answer is "no")