Skip to content
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

assert.throwsAsync incorrectly tolerates a result then which returns a non-thenable #4186

Closed
gibson042 opened this issue Aug 1, 2024 · 0 comments · Fixed by #4187
Closed

Comments

@gibson042
Copy link
Contributor

e.g.,

asyncTest(async function() {
  const badThenable = { then(){} };
  assert.throwsAsync(Error, function() { return badThenable; });
});

should not succeed (because the thenable never settles to anything, let alone the expected rejection), but it does because the result of then is used to directly resolve the assert.throwsAsync promise (i.e., assuming that then is itself conforming). Instead, res should itself be absorbed into an actual Promise which will definitely invoke the appropriate then callback upon settlement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant