Skip to content

CLI: Show multiple favicons warning as debug message#34069

Open
remino wants to merge 2 commits intostorybookjs:nextfrom
remino:remino-debug-multiple-favicons
Open

CLI: Show multiple favicons warning as debug message#34069
remino wants to merge 2 commits intostorybookjs:nextfrom
remino:remino-debug-multiple-favicons

Conversation

@remino
Copy link

@remino remino commented Mar 8, 2026

Related to Discord message:
https://discord.com/channels/486522875931656193/1106615915321229372/1479432853287731220

No issue was filed.

What I did

A logger.warn() message was displayed before. Changing to logger.debug().

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

Caution

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

  1. Build a sandbox: yarn task --task sandbox --start-from auto --template react-vite/default-ts

  2. Go into the directory of the sandbox: cd ../storybook-sandboxes/react-vite-default-ts

  3. Install packages: yarn

  4. Add favicons: touch public/favicon.{ico,svg}

  5. Set staticDirs in .storybook/main.ts:

     export default defineMain({
    +  staticDirs: ['../public’],
  6. Add --loglevel debug to storybook task in package.json:

    -    "storybook": "NODE_OPTIONS='--preserve-symlinks --preserve-symlinks-main' STORYBOOK_TELEMETRY_URL=\"http://localhost:6007/event-log\" storybook dev -p 6006”,
    +    "storybook": "NODE_OPTIONS='--preserve-symlinks --preserve-symlinks-main' STORYBOOK_TELEMETRY_URL=\"http://localhost:6007/event-log\" storybook dev -p 6006 --loglevel debug”,
  7. Run Storybook: yarn storybook

  8. Debug message should appear: [DEBUG] Looks like multiple favicons were detected. Using the first one.

Documentation

N/A. I couldn’t find any mention of warning messages for multiple favicons detected.

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

Summary by CodeRabbit

  • Chores
    • Adjusted logging to provide more detailed debug information for favicon detection scenarios.

A logger.warn() message was displayed before. Changing to
logger.debug().
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 8, 2026

📝 Walkthrough

Walkthrough

Changes demote favicon detection logging from warning to debug level in both source code and corresponding test file. No functional logic is altered; only the severity of logged messages when multiple favicons are detected is adjusted.

Changes

Cohort / File(s) Summary
Favicon Detection Logging
code/core/src/core-server/presets/common-preset.ts, code/core/src/core-server/presets/favicon.test.ts
Downgrades logging level from warn to debug for multiple favicon detection. Test descriptions and assertions updated to verify debug logging instead of warning.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
code/core/src/core-server/presets/favicon.test.ts (1)

49-55: Consider using spy: true option for the logger mock.

The mock pattern here doesn't use the { spy: true } option, which is recommended by the coding guidelines for Vitest mocks. While this is a pre-existing pattern not introduced in this PR, consider aligning with the guideline for consistency.

Additionally, the mock only exposes debug now—if future tests need other logger methods, they'd need to be added. This is fine for the current scope.

♻️ Optional: Align with spy mocking guidelines
-vi.mock('storybook/internal/node-logger', () => {
-  return {
-    logger: {
-      debug: vi.fn(() => {}),
-    },
-  };
-});
+vi.mock('storybook/internal/node-logger', { spy: true });

Then access the mocked logger in tests:

import { logger } from 'storybook/internal/node-logger';
// ...
expect(vi.mocked(logger.debug)).toHaveBeenCalledWith(expect.stringContaining('multiple favicons'));

As per coding guidelines: "Use vi.mock() with the spy: true option for all package and file mocks in Vitest tests"

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@code/core/src/core-server/presets/favicon.test.ts` around lines 49 - 55,
Update the Vitest mock of 'storybook/internal/node-logger' to use the spy option
by calling vi.mock(..., { spy: true }) while keeping the returned shape
(logger.debug) so tests continue to run; then update tests to assert via
vi.mocked(logger.debug) rather than raw function references (importing logger
from 'storybook/internal/node-logger' and using vi.mocked(logger.debug) in
expectations).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@code/core/src/core-server/presets/favicon.test.ts`:
- Around line 49-55: Update the Vitest mock of 'storybook/internal/node-logger'
to use the spy option by calling vi.mock(..., { spy: true }) while keeping the
returned shape (logger.debug) so tests continue to run; then update tests to
assert via vi.mocked(logger.debug) rather than raw function references
(importing logger from 'storybook/internal/node-logger' and using
vi.mocked(logger.debug) in expectations).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e5eb5f89-fbfe-4c57-beb2-ffe73ae3f025

📥 Commits

Reviewing files that changed from the base of the PR and between 533dcc0 and fddafe6.

📒 Files selected for processing (2)
  • code/core/src/core-server/presets/common-preset.ts
  • code/core/src/core-server/presets/favicon.test.ts

@Sidnioulz Sidnioulz self-assigned this Mar 8, 2026
@Sidnioulz Sidnioulz added maintenance User-facing maintenance tasks cli ci:normal labels Mar 8, 2026
@Sidnioulz Sidnioulz moved this to In Progress in Core Team Projects Mar 8, 2026
@Sidnioulz Sidnioulz changed the title Show multiple favicons warning as debug message CLI: Show multiple favicons warning as debug message Mar 8, 2026
@remino
Copy link
Author

remino commented Mar 9, 2026

Not sure what’s going on with the failed tests here. I haven’t touched those parts. Maybe they were failing before?

@Sidnioulz
Copy link
Member

Not sure what’s going on with the failed tests here. I haven’t touched those parts. Maybe they were failing before?

Yeah. The Linux tests job is flaky and the UI tests has a failure right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:normal cli maintenance User-facing maintenance tasks

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants