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

testharness.js: Promise check in test() is broken #25319

Closed
rakuco opened this issue Sep 1, 2020 · 2 comments
Closed

testharness.js: Promise check in test() is broken #25319

rakuco opened this issue Sep 1, 2020 · 2 comments
Assignees

Comments

@rakuco
Copy link
Member

rakuco commented Sep 1, 2020

The test() function fails when the function it runs returns a value. It then tries to determine if the value is a Promise to suggest using promise_test() instead. To do so, it checks if the returned value has an own property called "then".

This does not work correctly, as then() is defined in Promise.prototype, not Promise itself. Quick way to reproduce:

test(async t => {
}, "my test");

The harness error is "Test named "my test" inappropriately returned a value" rather than "Test named "my test" inappropriately returned a value, consider using promise_test instead".

@rakuco
Copy link
Member Author

rakuco commented Sep 1, 2020

Tentatively assigning to @jugglinmike because the code was introduced in #12958.

@stephenmcgruer
Copy link
Contributor

I fixed this (I believe) in a drive-by in #25703

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

No branches or pull requests

3 participants