-
Notifications
You must be signed in to change notification settings - Fork 469
Open
Labels
bugSomething isn't workingSomething isn't workingdocumentationAn update needs to be made to documentationAn update needs to be made to documentation
Description
Jest hangs on the following sample test:
const { waitFor } = require("@testing-library/dom");
describe("test", () => {
it("test", async () => {
let value = 1;
setTimeout(() => {
value = 2;
});
await waitFor(() => {
// both these lines are important: it's necessary to do a mutation and to fail in the first iteration
// It works normally, if we comment one of these lines
document.body.setAttribute("data-something", 'whatever');
expect(value).toEqual(2);
});
console.log("execution never comes here");
});
});
Two conditions have to be met:
- there should be a DOM mutation in waitFor callback
- first execution of waitFor callback should fail
Expected result:
waitFor should resolve the promise after a successful iteration regardless whether there were DOM mutations or not
Current result:
waitFor calls the callback infinitely even if subsequent iterations don't throw any exception.
Environment:
@testing-library/[email protected]
[email protected]
ptiger10
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdocumentationAn update needs to be made to documentationAn update needs to be made to documentation