Repository navigation
Addon-vitest: Filter Storybook instrumentation from reported stack traces - #36120
Merged
Merged
Conversation
…aces Instrumented expect/userEvent calls put a handful of Storybook wrapper frames between the failing assertion and the story, which Vitest then reports and uses for its code excerpt. Register those bundles with Vitest's onStackTrace hook so they are dropped while parsing, and build the component test status description from the source-mapped frames instead of the raw browser stack, so MCP and the tools CLI report file paths rather than Vite dev-server URLs.
ghengeveld
marked this pull request as ready for review
September 1, 2026 15:04
Contributor
|
Caution Review failedAn error occurred during the review process. Please try again later. Comment |
JReinhold
approved these changes
Sep 1, 2026
2 tasks done
This was referenced Sep 5, 2026
Merged
brandhaug
added a commit
to brandhaug/b2b-saas-starter
that referenced
this pull request
Sep 5, 2026
## Dependency Updates | Package | From | To | Type | | --- | --- | --- | --- | | `storybook` | 10.5.10 | 10.6.0 | minor | ## Release Notes <details> <summary><b>storybook</b> (10.5.10 → 10.6.0)</summary> ## 10.6.0 > New skills architecture for agentic workflows Storybook 10.6 contains hundreds of fixes and improvements: - 💻 CLI bindings for agent tools/skills -🅰️ Angular-Vite MCP/skills support and improved docgen/snippets (experimental) - 🟢 Vue MCP/skills support and improved docgen/snippets (experimental) - 🧩 Tanstack / NextJS-Vite framework bugfixes - ⚡ Improved performance and reduced bundle size <details> <summary>List of all updates</summary> - Addon MCP: Stop silently dropping composed refs from MCP composition - [#36077](storybookjs/storybook#36077), thanks @<!---->kasperpeulen! - Addon Vitest: Pin storybook/test in optimizeDeps so its CJS-only deps are prebundled - [#35572](storybookjs/storybook#35572), thanks @<!---->Nic-Polumeyv! - Addon Vitest: Report test runs with failures as failed tool outcomes - [#36080](storybookjs/storybook#36080), thanks @<!---->kasperpeulen! - Addon Vitest: Resolve story test globs against the project root - [#36103](storybookjs/storybook#36103), thanks @<!---->kasperpeulen! - Addon-vitest: Filter Storybook instrumentation from reported stack traces - [#36120](storybookjs/storybook#36120), thanks @<!---->ghengeveld! - Angular Vite: Resolve tsConfig against the workspace root - [#36026](storybookjs/storybook#36026), thanks @<!---->ndelangen! - Angular-Vite: Run Compodoc on demand - [#35776](storybookjs/storybook#35776), thanks @<!---->valentinpalkovic! - Angular: Add an in-process docgen analyzer, replacing Compodoc under the flag - [#35805](storybookjs/storybook#35805), thanks @<!---->valentinpalkovic! - Angular: Bind only what the component accepts in story snippets, and report the rest - [#35943](storybookjs/storybook#35943), thanks @<!---->valentinpalkovic! - Angular: Decide the migration\'s zone.js import from the dependency tree - [#36008](https://github.com/story …[full notes](https://github.com/storybookjs/storybook/releases/tag/v10.6.0) </details> --- *This PR was auto-generated by [catalog-update-action](https://github.com/brandhaug/catalog-update-action).* Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
brandhaug
added a commit
to brandhaug/b2b-saas-starter
that referenced
this pull request
Sep 5, 2026
## Dependency Updates | Package | From | To | Type | | --- | --- | --- | --- | | `@storybook/react-vite` | 10.5.10 | 10.6.0 | minor | ## Release Notes <details> <summary><b>@<!---->storybook/react-vite</b> (10.5.10 → 10.6.0)</summary> ## 10.6.0 > New skills architecture for agentic workflows Storybook 10.6 contains hundreds of fixes and improvements: - 💻 CLI bindings for agent tools/skills -🅰️ Angular-Vite MCP/skills support and improved docgen/snippets (experimental) - 🟢 Vue MCP/skills support and improved docgen/snippets (experimental) - 🧩 Tanstack / NextJS-Vite framework bugfixes - ⚡ Improved performance and reduced bundle size <details> <summary>List of all updates</summary> - Addon MCP: Stop silently dropping composed refs from MCP composition - [#36077](storybookjs/storybook#36077), thanks @<!---->kasperpeulen! - Addon Vitest: Pin storybook/test in optimizeDeps so its CJS-only deps are prebundled - [#35572](storybookjs/storybook#35572), thanks @<!---->Nic-Polumeyv! - Addon Vitest: Report test runs with failures as failed tool outcomes - [#36080](storybookjs/storybook#36080), thanks @<!---->kasperpeulen! - Addon Vitest: Resolve story test globs against the project root - [#36103](storybookjs/storybook#36103), thanks @<!---->kasperpeulen! - Addon-vitest: Filter Storybook instrumentation from reported stack traces - [#36120](storybookjs/storybook#36120), thanks @<!---->ghengeveld! - Angular Vite: Resolve tsConfig against the workspace root - [#36026](storybookjs/storybook#36026), thanks @<!---->ndelangen! - Angular-Vite: Run Compodoc on demand - [#35776](storybookjs/storybook#35776), thanks @<!---->valentinpalkovic! - Angular: Add an in-process docgen analyzer, replacing Compodoc under the flag - [#35805](storybookjs/storybook#35805), thanks @<!---->valentinpalkovic! - Angular: Bind only what the component accepts in story snippets, and report the rest - [#35943](storybookjs/storybook#35943), thanks @<!---->valentinpalkovic! - Angular: Decide the migration\'s zone.js import from the dependency tree - [#36008](https://github.com/story …[full notes](https://github.com/storybookjs/storybook/releases/tag/v10.6.0) </details> --- *This PR was auto-generated by [catalog-update-action](https://github.com/brandhaug/catalog-update-action).* Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.
What I did
A failing
expectin a play function reported seven frames of Storybook plumbing above the story that triggered it, which also made Vitest print its code excerpt from insideInstrumenter.invokeinstead of from the story file:Instrumenting
expect,userEventand Testing Library is what lets the Interactions panel replay a play function step by step, so those wrapper frames are unavoidable; they just should not be reported. The Interactions panel was already unaffected because it renders matcher diffs rather than stacks.Terminal, IDE and CI output. Vitest parses
error.stackonce per failure, source-maps each frame, drops frames matching its ignore list and caches the result onerror.stacks, which every reporter then reads. Storybook's bundles were not in that ignore list. The Vitest project config thestorybookTestplugin returns now registers atest.onStackTracehook that filters them, chaining to any hook the user already configured. After this change the first frame is the story, so the code excerpt points there too.MCP and tools CLI output. That path is separate: it read the raw
error.stackstring, which in browser mode is a list ofhttp://localhost:PORT/.../sb-vitest/deps/chunk-*.jsURLs.TestManagernow builds the component test status description fromerror.stacks, so consumers get source-mapped file paths with the instrumentation already filtered. Since that switch takes the message fromerror.message, which carries the ANSI "Click to debug" banner thatsetup-file.tsprepends, the banner is stripped there.The frame predicate matches Storybook's bundles in the shapes a frame can take: the published
storybook/distand@storybook/*/distlayouts after source maps are applied, and the pre-bundleddeps/storybook_*files Vite serves when no source map is available.Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
Caution
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
yarn task sandbox --template react-vite/default-ts --start-from autosrc/stories/Page.stories.ts, make theLoggedInstory fail by changingawait expect(loginButton).not.toBeInTheDocument();toawait expect(loginButton).toBeInTheDocument();npx vitest run❯ toBeInTheDocument src/stories/Page.stories.ts:30:60as its first frame and prints the code excerpt from that story file. No frames fromnode_modules/storybook/dist/test/index.js,node_modules/storybook/dist/instrumenter/index.jsor@storybook/addon-vitest/dist/...should appear.throw new Error('boom')in the play function, or a component that throws during render) and confirm the reported stack is still useful and points at project code.onStackTrace: (error, frame) => { console.log('user hook', frame.file); return true; }totestin the Vitest config, runnpx vitest runagain, and confirm the hook still logs, i.e. a user-configured hook is not shadowed.yarn storybook), runnpx storybook tools test run --stories '[{\"storyId\":\"example-page--logged-in\"}]'. The failing story section should show the assertion message followed by source-mapped file paths, nothttp://localhost:PORT/...URLs, and no instrumentation frames.Most likely to regress: the frame matching is path-based, so Windows paths deserve a look (covered by a unit test, but worth confirming on a real Windows run); the status description format changed, which is what both the Storybook UI and the agent tooling display.
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsDeclare whether manual QA will be needed for this PR during the next release, through
qa:neededorqa:skipMake 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
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>