test: filter noisy default-theme console warning in browser tests - #2698
Open
joyenjoyer wants to merge 1 commit into
Open
test: filter noisy default-theme console warning in browser tests#2698joyenjoyer wants to merge 1 commit into
joyenjoyer wants to merge 1 commit into
Conversation
Components rendered without an InstUISettingsProvider fall back to the default canvas theme and log this warning on every render, drowning out real warnings in CI. Filter it out via a plain console.warn reassignment so it survives vi.restoreAllMocks() and stays in effect across all tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
matyasf
requested changes
Aug 27, 2026
matyasf
left a comment
Collaborator
There was a problem hiding this comment.
works well, just some stylistic changes
Comment on lines
+43
to
+49
| // Components are rendered directly in tests, without wrapping them in an | ||
| // <InstUISettingsProvider>, so `useTheme()`/`getTheme()` always fall back to | ||
| // the default `canvas` theme and log this warning on every render. It's | ||
| // expected in this context and just drowns out real warnings in CI, so we | ||
| // filter it out here. This is a plain reassignment (not `vi.spyOn`), so it | ||
| // survives the `vi.restoreAllMocks()` above and stays in effect for every | ||
| // test, including ones that install their own `console.warn` spy on top of it. |
Collaborator
There was a problem hiding this comment.
this is way too verbose. I'd just write:
Do not let test components spam the logs because they are not wrapped in InstUISettingsProvider.
| console.warn = (...args: Parameters<typeof console.warn>) => { | ||
| if ( | ||
| typeof args[0] === 'string' && | ||
| NOISY_WARNINGS.some((message) => (args[0] as string).includes(message)) |
Collaborator
There was a problem hiding this comment.
I would simplify this, no need for the array. Just do
'No theme provided for [InstUISettingsProvider], using default'.includes(message)
no need for the generic filter code
HerrTopi
reviewed
Aug 27, 2026
HerrTopi
left a comment
Contributor
There was a problem hiding this comment.
Should we print a warning at all? That's why we have a default, don't we? In this case, canvas (who is hyper sensitive to warnings) can't use this with the default option
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR bypasses the noise in test logs caused by adding:
No theme provided for [InstUISettingsProvider], using default <canvas> theme.multiple times.INSTUI-5163