Open simonhaenisch opened 6 years ago
If mocha is executing the before
hook on a skipped test then that's actually a bug in Mocha (and who knows it may be an open issue somewhere).
Mocha isn't supposed to run hooks for tests it knows it's not going to run. For instance I know for sure that beforeEach
and afterEach
tests are not run...
Well, it's running the before
hook before the first test, disregarding whether it's skipped or not... so I wouldn't really call it a bug (couldn't find anything in their issues), more of a design choice/issue maybe. I would think that before
and after
should actually be listed outside specific it()
tests, while beforeEach
and afterEach
could still stay within the test context:
Test
- BEFORE ALL
- First Test (skipped)
- Second Test
- BEFORE EACH
- ASSERT
- LOG blah blah
- AFTER EACH
- AFTER ALL
If you're saying that your reporting style is based on Mocha's, then yeah I could report it as an upstream issue to "fix" in their reporter (if they consider it a bug).
The same issue is reproduced for the AFTER ALL
hook.
If last IT
is skipped - AFTER ALL
works, but not shown in the test runner
Hey, any update about this issue?
Is there any update? It is still reproduced on cypress 11
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.
This issue has been closed due to inactivity.
Is this a Feature or Bug?
Bug
Current behavior:
The first test is shown as skipped in the test runner and is not collapsable, but the
before
hook gets executed within it (and thus it should show the "before all" log). There is no way to figure out through the UI whether thebefore
hook was successfully executed.Desired behavior:
Possible Solutions:
describe
but outside of theit
testsI'd prefer the third solution, since the
before
/after
hooks don't really belong to any specific test.Steps to reproduce:
Versions
cypress@3.0.0
, latest Chrome, macOS 10.13.4