-
-
Notifications
You must be signed in to change notification settings - Fork 305
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
Fix spurious "test exited without ending" #374
Conversation
If the glob fails, the |
bin/tape
Outdated
}); | ||
var files; | ||
try { | ||
files = glob.sync(arg); |
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.
When in the async version would an error be generated by glob, compared to the sync version?
Separately, I appreciate that the current PR mirrors the original version's error handling precisely; but it might be better to let glob.sync
's error throw, rather than having an undefined.forEach
error. I'd consider that change semver-patch, since it's just making the error message more helpful.
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.
When in the async version would an error be generated by glob, compared to the sync version?
I expect would be generated in the same situations. The docs are unclear about which conditions generate errors. In the case that a glob matches no files, an empty array of files is returned (no error).
I agree with you about undefined.forEach
being unhelpful. I will update the PR so that glob.sync
throws. An alternative would be to suppress/ignore any errors (as the original code was doing).
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.
To my reading, the original code would still throw the undefined.forEach
error, it'd just be thrown from the async callback.
For async logic which achieves the same goal (but in a different context), see here. |
The PR is updated now to address @ljharb's feedback. |
Fixes #223. @Raynos identified this line as the issue: #223 (comment) Let's finally fix this :)
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.
Thanks!
I'll cut a release of this later today. |
@ljharb Nice, thanks! |
Fixes: #223
This PR ensures that all test files are required on the first tick.
To make
tape
happy, all tests need to be queued on the first tick. Tape assumes that tests are done when there's nothing in the queue.Right now, the
tape
binary is asynchronously resolving the globs and queuing up the tests as those callbacks are called. This can lead to spurious "test exited without ending" errors.@Raynos identified this line as the issue a while back #223 (comment) Let's finally fix this :)