-
-
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 3 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
describe('suite', function () { | ||
beforeEach(function () { this.skip() }) | ||
after(function () { console.log('after in suite') }) | ||
it('test', function () {}) | ||
}) | ||
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. How about some names that make this file's function obvious (both in viewing this file and if it were to end up run among the main tests in addition to the meta test calling it by 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. @ScottFreeCode I don't see this stuff as absolutely necessary given the filename, but if you wish to add to the branch, go for it 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. actually on second thought, I like your test above. please use it instead 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. (to the first reply:) Yeah, it's pretty clear from the filename what issue this is testing, but it's not so obvious to me from looking just at this file that this is meant to be run by another test in another file that tests the output of this one (unless that's what all the stuff in this fixtures folder is -- I haven't looked at the files that were already there), so it looked at first as though this weren't actually testing it programmatically but only printing something to look at manually. 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. (to the second:) You mean the one that uses nested suites with code like this in the inner one and a test in the 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. (Went ahead and committed both; feel free to rebase away either you don't want.) |
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")