Skip to content

fix(jest): ignore storybook-static and package __mocks__ directories#37946

Open
rusackas wants to merge 1 commit intomasterfrom
fix/jest-nested-node-modules-esm
Open

fix(jest): ignore storybook-static and package __mocks__ directories#37946
rusackas wants to merge 1 commit intomasterfrom
fix/jest-nested-node-modules-esm

Conversation

@rusackas
Copy link
Member

Summary

Fixes local Jest test runs that were failing with confusing errors due to duplicate files being scanned.

Issues Fixed

  1. Haste module naming collision

    jest-haste-map: Haste module naming collision: superset
      * <rootDir>/package.json
      * <rootDir>/storybook-static/package.json
    

    The storybook-static/ build artifact contains a copy of package.json with "name": "superset", causing Jest's Haste module resolver to fail.

  2. Duplicate manual mock warnings

    jest-haste-map: duplicate manual mock found: mockExportObject
      * <rootDir>/spec/__mocks__/mockExportObject.js
      * <rootDir>/packages/superset-ui-core/__mocks__/mockExportObject.js
    

    The packages/superset-ui-core/__mocks__/ directory contains copies of the canonical mocks in spec/__mocks__/, causing ambiguity.

Solution

Add these directories to modulePathIgnorePatterns in jest.config.js:

  • <rootDir>/storybook-static - build artifact directory
  • <rootDir>/packages/.*/__mocks__ - package-level mocks (canonical mocks are in spec/__mocks__/)

Test Plan

  • Ran npx jest --testPathPatterns="deckgl" - all 273 tests pass
  • No more Haste naming collision or duplicate mock warnings

🤖 Generated with Claude Code

Jest was encountering issues when running tests locally:

1. **Haste module naming collision**: storybook-static/package.json
   contains `"name": "superset"` which conflicts with the main
   package.json, causing "Haste module naming collision: superset"

2. **Duplicate manual mock warnings**: packages/superset-ui-core/__mocks__/
   contains the same mock files as spec/__mocks__/, causing
   "duplicate manual mock found" warnings for mockExportObject,
   mockExportString, and svgrMock

These issues were causing local test runs to fail or behave
inconsistently. Adding these directories to modulePathIgnorePatterns
resolves both issues.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Feb 13, 2026

Code Review Agent Run #442926

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 9928251..9928251
    • superset-frontend/jest.config.js
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot bot added the change:frontend Requires changing the frontend label Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant