-
Notifications
You must be signed in to change notification settings - Fork 466
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
Tests with setTimeout fail after update to v7.29.6 #901
Comments
Encountered the same issue. It only happens when running Jest in GitHub Action CD though. Locally it works fine for me. |
Thanks for the report. A repro would help a lot here. Otherwise fixing the problem might be impossible unless we actually revert recent changes. |
@eps1lon I'll try to provide one by tomorrow |
@eps1lon I was unable to create a reproduction. It might be that somewhere in our tests fake timers are used without reverting back to real timers. I'll keep digging! |
@ma7moudat Thanks for coming back to let us know ;) I'll see what I can do. Busy week. |
Honestly, I don't think I'm able to as of now. The problem only seems to arise on a pretty specific setup and only in a GitHub Actions pipeline for my part. |
It seems like some tests of ATL are also failing with the latest version of DTL. I'll take a look at it in a couple of days. @ma7moudat I just noticed that you're using the Angular Testing Library. |
I am experiencing an issue that smells suspiciously similar to this. After updating RTL to 11.2.5 and adding an execution of If I remove the Now, if I add If I move the Aside from this information, I currently have no idea what's going on. "@testing-library/jest-dom": "5.11.4", |
I also just faced with something related to this issue. For me, it happens since version It looks like, in my case, there is something related to When I run a single test, it works as expected. However, when I run multiple tests, where I use code like, function onReadyWithCleanup(cb) {
let cleanupCb = () => {}
const intervalId = setInterval(() => {
if (window.someSideEffect) {
cb()
cleanupCb()
}
})
cleanupCb = () => clearInterval(intervalId)
return cleanupCb
}
function SomeComponent() {
const [value, setValue] = useState('')
useEffect(() => {
const cleanupCb = onReadyWithCleanup(() => {
setValue(`I'm ready!`)
})
return cleanupCb
}, [])
} it starts producing
|
The root of my problem is here v7.29.4...v7.29.5#diff-49ba0c85360693b8e89ae0e0428284a55db749f08f2b9993d26910def646e02fR28-R32 I don't use fake timers, but When I excluded it from |
This issue should be fixed as of 7.30.4. If the issue persists, please open a new issue and include a reproduction. Otherwise we have to assume that you're pulling in an older version at some point. |
@testing-library/dom
version: 7.29.6Relevant code or config:
What you did:
Nothing, test was running fine before updating from 7.29.4 to 7.29.6. Now it fails with the error message below.
What happened:
Problem description:
Now one of the following changes the outcome:
jest.useRealTimers()
fixes the test, but it doesn't make sense to call it in every test or test suite that uses testing-library.await sleep(100)
which usessetTimeout
moves the test further, but the asserts fail since the needed nodes aren't available yet. UsingwaitFor
didn't help.The text was updated successfully, but these errors were encountered: