-
-
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
Test case skip()ed, beforeEach() hook still executed, afterEach() missed #2546
Comments
I do agree that it's strange and probably a bug that Y and Z do not run, but B does. That's just wrong. However, I think the inner beforeEach will always run unless you call
the I don't it's well specified or understand what will happen if you call this.skip() inside a hook. Ideally it would be named, this.continue() or something like that, because all it means is that "we are done here" let's move to the next item. |
I am a bot that watches issues for inactivity. |
This is an issue for several projects I work on, so I'd like to see it stay open. |
Looks like this issue might be related to this line of code: Lines 671 to 673 in ade8b90
Which I discovered when reporting this on a related issue here: #2571 (comment) Commenting out the above code makes this work as expected (for me), but I'm not sure if that code is needed for other features. |
@juergba could you take a look at this and provide your opinion? |
@plroebuck see above, I have a PR pending on this.
Yes, everybody has his own expectations, so first you would have to define/agree on a hook pattern before changing the code. |
I think most people assume that, if their In many cases tests will error if a |
@philipwalton see #3740. We have many identified issues, but it's not as trivial to determine the ramifications of proposed changes against a myriad of possible user settings and configurations (e.g., should it still run "afterEach" if test fails when |
This with Mocha 3.1.2. Source test file:
Expected output: either "B" and "Y" should be printed, or neither "B" nor "Y" should be printed.
Actual output: "B" is printed, but not "Y":
In general,
skip()
, then I would not expect that innerbeforeEach
blocks would be executed.beforeEach
block is executed, then the correspondingafterEach
blocks should also be executed, for symmetry.The text was updated successfully, but these errors were encountered: