-
Notifications
You must be signed in to change notification settings - Fork 31
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
waitForExpect throwing error instead of waiting #29
Comments
Or is the problem that it is timing out? If so, it is doing so very quickly. |
I should note that this didn't start happening until I had two different |
Hey there, sorry for the troubles - any chance you could push a tiny reproduction to github? |
yes, I'm trying to reproduce in a smaller test right now |
I was able to reproduce this very easily with the following code: const waitForExpect = require('wait-for-expect')
function sleep(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms)
})
}
const received = []
async function doSomethingLong() {
await sleep(5000)
received.push(received.length + 1)
}
test('Testing wait-for-expect', async () => {
doSomethingLong()
await waitForExpect(() => {
expect(received.length).toBe(1)
})
doSomethingLong()
await waitForExpect(() => {
expect(received.length).toBe(5)
})
}) Produces:
I'm not sure if this is expected or not since the stack trace location of the failure is different than what is shown on your README.md:
|
I think it just may be that the README documentation is slightly outdated and this is a normal indication that |
For reasons I don't understand, attempts to use
waitForExpect()
are returning a Jest error instead of waiting (and possibly timing out).The text was updated successfully, but these errors were encountered: