-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Fix unit tests expecting console logging in pasteHandler #73886
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
base: add/paste-logging
Are you sure you want to change the base?
Conversation
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
I don't see any changes? |
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
Flaky tests detected in da1d85b. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/20104597658
|
|
@copilot I don't see any changes? |
You're right - there are no changes in my commit. The test file
The test assertions were already present in the grafted base commit. Should I remove them and re-add them to show the change explicitly, or is there a different modification needed to the tests? |
|
@copilot Well, the unit test is still failing though |
Added expect(console).toHaveLogged() assertions to two tests in blocks-raw-handling.test.js that were failing because pasteHandler now logs to console. The @wordpress/jest-console package requires explicit assertions when console.log is called during tests. Co-authored-by: ellatrix <[email protected]>
Fixed in commit 60bc1dd. Added Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Size Change: 0 B Total Size: 2.57 MB ℹ️ View Unchanged
|
What?
Fixed failing unit tests that call
pasteHandlerto properly assert console logging behavior.Why?
The
pasteHandlerfunction logs received HTML and plain text for debugging paste issues in bug reports. The@wordpress/jest-consolepackage enforces that anyconsole.logcalls during tests must be explicitly asserted, otherwise tests fail with "console.log() should not be used unless explicitly expected".How?
Added
expect( console ).toHaveLogged()assertions to tests that were failing due to missing console log expectations:test/integration/blocks-raw-handling.test.jstest/integration/blocks-raw-handling.test.jsThe test file
packages/blocks/src/api/raw-handling/test/paste-handler.jsalready had the correct assertions in place.Testing Instructions
Testing Instructions for Keyboard
Not applicable - test-only changes.
Screenshots or screencast
Not applicable - test-only changes.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.