[test] Properly wait for promise to resolve before expect #3597
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes one test not running in Safari: https://app.circleci.com/pipelines/github/mui-org/material-ui-x/11257/workflows/486e64b7-1fa4-44dc-8afa-e891edf3d561/jobs/65177
The solution is a workaround I proposed in #3372 (comment). Basically, the unit tests run with a fake clock, which causes
waitFor
to also run with the fake clock. Here I call the nativesetTimeout
to make sure that the promise was resolved. With #3558 I think we'll be able to use the fake clock on a per-test case basis, not in the entire suite.I also took the opportunity to copy
test/cli.js
from the core repo. This allows to debug each unit test using VSCode.