Skip to content

fix: remove unused CJS require of ESM-only @storybook/test-runner#510

Merged
hotlong merged 2 commits intomainfrom
copilot/create-patch
Feb 14, 2026
Merged

fix: remove unused CJS require of ESM-only @storybook/test-runner#510
hotlong merged 2 commits intomainfrom
copilot/create-patch

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 14, 2026

@storybook/test-runner@0.24.2 ships as ESM-only ("type": "module"). .storybook/test-runner.cjs was require()-ing it, failing all 78 Storybook test suites on main:

Must use import to load ES Module: .../node_modules/@storybook/test-runner/dist/index.js
  • Removed require('@storybook/test-runner')getStoryContext was imported but never referenced
  • Removed require('jest-snapshot')toMatchSnapshot was imported but unused (expect().toMatchSnapshot() uses Jest's built-in matcher)

No functional change to prepare, preVisit, or postVisit hooks.

Original prompt

发一个补丁


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectui Error Error Feb 14, 2026 1:52pm
objectui-demo Error Error Feb 14, 2026 1:52pm
objectui-storybook Error Error Feb 14, 2026 1:52pm

Request Review

…r config

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Add patch for code correction fix: remove unused CJS require of ESM-only @storybook/test-runner Feb 14, 2026
Copilot AI requested a review from hotlong February 14, 2026 13:53
@hotlong hotlong marked this pull request as ready for review February 14, 2026 13:53
Copilot AI review requested due to automatic review settings February 14, 2026 13:53
@hotlong hotlong merged commit 4da9083 into main Feb 14, 2026
12 of 16 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a critical ESM/CJS compatibility issue that was causing all 78 Storybook test suites to fail. The @storybook/test-runner@0.24.2 package is ESM-only, but .storybook/test-runner.cjs was attempting to require() it, resulting in "Must use import to load ES Module" errors.

Changes:

  • Removed unused require('@storybook/test-runner') that imported getStoryContext (never referenced in the code)
  • Removed unnecessary require('jest-snapshot') that imported toMatchSnapshot (Jest matcher is globally available in test-runner environment, no explicit import needed)

Copilot AI mentioned this pull request Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants