-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
test: Enable jest-console for native tests #53125
Conversation
Ensure accidental errors, warnings, or logs are not outputted during tests.
Size Change: -401 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
4bf895d
to
6083ac4
Compare
6083ac4
to
ca0f32f
Compare
Toggling HTML mode results in expected re-renders. We must wrap the invocation in `act` to communicate that to Jest.
Synchronous queries are generally easier to comprehend.
act( () => { | ||
toggleMode(); | ||
} ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Toggling HTML mode results in intentional updates and re-renders. We must wrap this call in act
to communicate that intent to Jest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎊 !
I've added a comment regarding removing no-longer-needed imports, but shouldn't block merging this PR.
This library is now included universally for all tests via test environment configuration and setup files.
The log introduces additional, un-filterable noise that can impair one's ability to use logs for debugging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reviewed the last changes and look good to me .
What?
Enable
@wordpress/jest-console
for the native editor automated tests.Why?
Ensure accidental errors, warnings, and logs are not outputted during tests.
For example, an
act
warning will now cause a test failure.Additionally, this will further align native editor tests with web editor tests.
How?
Enable the
@wordpress/jest-console
package within the native tests Jestconfiguration, much like the web editor tests. Add assertions and to do comments
for all pre-existing logs that need to be addressed.
Testing Instructions
n/a
Testing Instructions for Keyboard
n/a
Screenshots or screencast
n/a