-
-
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
an error in a beforeEach hook causes the test run to terminate prematurely #581
Comments
yeah mocha currently assumes that if you have an issue in before hooks then subsequent things will fail, though we could limit the scope of that assumption to only those test-cases nested within the same describe() |
Is this slated for a fix at any point? |
yup, just low priority ATM |
Is anybody currently working on a fix for this? I'll write one otherwise, but I don't want to duplicate effort. Do you think the new limited scope should be enabled by default, or by a flag? |
default should be fine since the problem is likely self-contained within that block of nested describe()s, if it's a database connection error or similar and other suites use that db they'll just fail as well no big deal |
Sounds good; I'll give it a crack when I get to work on Monday :) On Nov 17, 2012, at 11:51 AM, TJ Holowaychuk [email protected] wrote:
|
great! thanks |
Any update on this? I though #270 was talking about this problem - it describes the same scenario but is less specific about expected result. I've got a good ways toward handling all four types of hooks and have tests to cover the work I've done so far. https://github.com/bitwiseman/mocha/tree/hooks-recovery . This does not fully address timeouts in async hooks or uncaught, but is still a huge step forward. This does a bit more the previously proposed fix - things have changed in six months. I disagree with the assumption that if a hook fails once it will fail every time as a justification for bailing on the test run. Even if a number of tests will fail, it is better to keep going and get results. |
optimizing for failure is itself not a great practice, bailing from the failed suite is definitely ideal IMO, maybe not from the entire process but definitely the suite |
I'm also getting bit by this behavior. I would assume that a The case I'm working with is iOS Instruments testing, where the Instruments process itself (which I contact to start a new session using I want them to keep running so that I can at least have all tests attempt to run. With things how they are now, I can never make it through an entire run of > 100 tests because Instruments is so flakey it will crash at least once in the first 10-20 tests. In this case it's clearly not a Mocha issue, but I think allowing for a bit of flexibility on how |
We also encounter these when we're using mocha for integration tests for deployed webapps. I agree with @jlipps that beforeEach() should be attempted again if your dealing with let's say a flaky api endpoint. @jlipps do you mind sharing, how are you currently getting around this mocha limitation in your apps? |
+1 for the fix/workaround for this. 👿 |
fix/workaround described in comments for #1014 |
fixed by #1043 |
Uncaught TypeError: vue_router__WEBPACK_IMPORTED_MODULE_2__.default.beforeEach is not a function if (authRequired && !loggedIn) { next(); |
i'm still seeing the same issue? any update on this? |
Testcase: https://gist.github.com/3711350
As you can see from the output, only one example was executed. I would have expected the first example to fail, and then the second two to execute and pass.
The text was updated successfully, but these errors were encountered: