-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
async iterator can cause silent process exit in Deno.test()
#7088
Comments
I'm investigating this issue. |
This is caused because neither So true minimum reproducible would be: Deno.test({
name: "bug",
fn() {
return new Promise((_resolve, _reject) => {
console.log("in promise");
// Neither `resolve` nor `reject` is called
});
},
});
Deno.test({
name: "ok",
async fn() {
console.log("ok test");
},
}); The output looks like:
It would be better for users if the other tests could be executed regardless of one test having ever-pending promise, though simply detecting a promise that will be never A possible solution I'm considering is
For example, timeout period would be set like this: Deno.test({
name: "bug",
fn() {
return new Promise((_resolve, _reject) => {
console.log("in promise");
});
},
timeout: 1000, // which is better, msec or sec...
});
Deno.test({
name: "ok",
async fn() {
console.log("ok test");
},
// timeout should be optional, so we have to decide reasonable default value
}); Then the output would change to:
I'd like to hear any opinions on my solution or this issue itself. |
I did some debugging of this issue - creating a promise without ever resolving/rejecting it doesn't really cause the process to exit - it causes to stop execution of remaining JS code in the runtime without any error - Maybe it's related to the fact that |
When #7946 lands this issue can be resolved by updating |
The following script
test.ts
causesdeno test
to silently perform the equivalent ofexit(0)
from within the testfn()
:All works as expected if the
bug
test is filtered out:My version info:
Note: This is a minimal reproducer for a bug that showed up in a timeout-based iterater, thus the odd construction.
File
test.ts
:The text was updated successfully, but these errors were encountered: