-
Notifications
You must be signed in to change notification settings - Fork 176
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
Lab crash on simple test code #994
Comments
I think we can handle this particular case of a pending nextTick, but I'm not certain how we would trap a setTimeout scheduled into the future. I also think this is up to the developer to handle any unfinished operations before resolving the test. That being said, here is a PR to fix this specific issue: #995 |
Yeah, I am not sure how to reliably handle this. We can solve it for one tick, but what about two? Three? I just want to ensure that we're handling realistic/likely and not a variety of contrived cases. If we could handle this in a generic way that would be excellent. Would that error's stack be able to point us back to the failing test? Could async hooks point us back there? Might require some research. |
As I understand, lab does not intend to check for these situations and I have doubts it should be tackled, at all. As @geek said, there will be other ways to delay exceptions and make asynchronous tests fail after their corresponding |
@gerardolima I would say that it is fair to expect lab to at least wait until the microtask queue has been emptied, before moving on. This can be done in 1 line of code. If the issue extends beyond the microtask queue, it should be handled by the feature I proposed in #988. |
hey, @kanongil, I believe when you say this change can be done in one single line; my question is: should lab handle this? Is it expected a test runner to handle scheduled events in its normal flow? And, particularly this one, which has simplicity as one of its core values? |
This is not about scheduled events. I'm talking about not yet resolved nextTicks and related microtask queue events, which can only have been queued during the active test. It is also about tests not crashing lab from an errant Node itself uses nextTick delays extensively. |
I wasn't sure |
Support plan
Context
What are you trying to achieve or the steps to reproduce?
To run test suite without lab crashing. Eg. the following with
lab fail.js -i 1
:fail.js:
What was the result you got?
What result did you expect?
Note that lab doesn't crash when running the full suite, but it assigns the error to the second test.
This specific issue can probably be remedied by letting ticks settle before treating the test as "completed".
The text was updated successfully, but these errors were encountered: