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

evaluate returns empty object when function throws #2613

Open
mmkal opened this issue Jul 7, 2022 · 0 comments
Open

evaluate returns empty object when function throws #2613

mmkal opened this issue Jul 7, 2022 · 0 comments

Comments

@mmkal
Copy link

mmkal commented Jul 7, 2022

Describe the bug

const x = await evaluate(() => {
  return document.querySelector('.doesNotExist').textContent
})

When no element with class doesNotExist exists x will have value {}. I think this is because it's a json-ified error.

To Reproduce

const { openBrowser, evaluate, goto } = require('taiko');
openBrowser();
goto('https://example.com')
const x = await evaluate(() => {
  return document.querySelector('.doesNotExist').textContent
})
console.log(x);

Expected behavior

evaluate should throw when the client function throws. It might require wrapping the function and returning an either type which includes the message and the stack of the error.

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

No branches or pull requests

1 participant