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

Failed to pass tests with latest React experimental builds #1498

Closed
dai-shi opened this issue Oct 27, 2022 · 7 comments · Fixed by #1860
Closed

Failed to pass tests with latest React experimental builds #1498

dai-shi opened this issue Oct 27, 2022 · 7 comments · Fixed by #1860
Assignees
Labels
help wanted Please someone help on this

Comments

@dai-shi
Copy link
Member

dai-shi commented Oct 27, 2022

#1497 reveals that a test fails with versions between:
https://www.npmjs.com/package/react/v/0.0.0-experimental-79c582981-20221021
and
https://www.npmjs.com/package/react/v/0.0.0-experimental-fecc288b7-20221025.

@dai-shi dai-shi self-assigned this Oct 27, 2022
@dai-shi
Copy link
Member Author

dai-shi commented Oct 27, 2022

facebook/react@65e32e5...79c5829

image

We probably need to use use.

@dai-shi
Copy link
Member Author

dai-shi commented Oct 31, 2022

#1512 still fails.
I'm not sure if the problem is on our end, or react, or testing-library.

Can anyone help?

@dai-shi dai-shi added the help wanted Please someone help on this label Oct 31, 2022
@dai-shi dai-shi removed their assignment Oct 31, 2022
@manakuro
Copy link
Contributor

manakuro commented Nov 16, 2022

It seems like some tests in tests/utils/atomWithObservable.test.tsx got stuck while executing. I'm going to dig into that.

await findByText('count: 9')

@manakuro
Copy link
Contributor

manakuro commented Nov 17, 2022

Turns out that the promise inside atomWithObservable is still pending after resolving, then the process got stuck.

resolve?.(result)

This causes only when the initialValue is not passed and the promise is used.

[email protected] executes rendering after the promise is resolved, but [email protected] doesn't. I guess it's related to the changes on [email protected].
facebook/react#25523

it works in the browser environment, though.
https://codesandbox.io/s/react-typescript-forked-forked-nr4wuk?file=/src/App.tsx

I will continue to work on that.

@manakuro
Copy link
Contributor

@dai-shi
This behavior occurs when you use jest.useFakeTimers and promise inside custom hooks. The rendering process got stuck while flushing the process inside the act. The cause of this might have something to do with the PR. I reported it, so we can keep track of what's going on.

facebook/react#25523 (comment)

As another option, we could flush the promises manually like this.
https://github.com/manakuro/test-react-experimental/pull/1/files

But still, there are some tests that got stuck in the tests/utils/atomWithObservable.test.tsx, so I need to figure this out.

@dai-shi
Copy link
Member Author

dai-shi commented Mar 31, 2023

@manakuro Could facebook/react#26512 be related or not?

@manakuro
Copy link
Contributor

@dai-shi I'm not sure the facebook/react#26512 has anything to do with our issue, but the new version, 18.3.0-next-1308e49a6-20230330 seems to have solved the fake timer issue. I have no idea, but it might be related to the changes.
facebook/react@4111002...1308e49

Please take a look at my PR.
#1860

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Please someone help on this
Projects
None yet
2 participants