Fix unit tests expecting console logging in pasteHandler#73886
Fix unit tests expecting console logging in pasteHandler#73886ellatrix merged 2 commits intoadd/paste-loggingfrom
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 <4710635+ellatrix@users.noreply.github.com>
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
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @Copilot. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.