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

rfc(error): improve timeout error stack trace for waitFor timeouts #92

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tomtomau
Copy link
Contributor

@tomtomau tomtomau commented Sep 19, 2019

Edit: I originally posted a gross hacky version but I think I found a passable solution like 15 minutes after posting the pull request and have force pushed that now


Full disclosure, I have no idea if this is a horrible idea or not 🙃

We have a stack of waitFor calls in our tests and while I was stumbling trying to resolve some problematic tests, I was frustrated that the stack trace of the exception was incredibly vague:

Error: Element not found

    at Timeout._onTimeout (/Users/tom/src/my-cool-app/node_modules/aurelia-testing/dist/commonjs/wait.js:67:10)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)

Even when I used a debugger, it was incredibly difficult to track down which waitFor call was causing me grief. After my solution I got a stack trace that helped my track down the specific failing call:

Error: Element not found

    at Object.waitFor (/Users/tom/src/my-cool-app/node_modules/aurelia-testing/dist/commonjs/wait.js:35:22)
    at /Users/tom/src/my-cool-app/assets/test/my-cool-component.spec.ts:144:39
    at step (/Users/tom/src/my-cool-app/assets/test/my-cool-component.spec.ts:33:23)
    at Object.next (/Users/tom/src/my-cool-app/assets/test/my-cool-component.spec.ts:14:53)
    at fulfilled (/Users/tom/src/my-cool-app/assets/test/my-cool-component.spec.ts:5:58)

Again, not sure if this is a terrible way to do this (I'm running this in node with js-dom, not sure about other setups?), but I hope it at least starts a conversation - maybe I'm missing something else that's simple?

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 this pull request may close these issues.

1 participant