fix(vscode): load mention-utils.js in the chat-panel test harness - #900
Open
addyCooks wants to merge 1 commit into
Open
fix(vscode): load mention-utils.js in the chat-panel test harness#900addyCooks wants to merge 1 commit into
addyCooks wants to merge 1 commit into
Conversation
chat-panel.js destructures globalThis.NanocoderMentionUtils, which mention-utils.js defines. The real webview loads both scripts in that order, but the test harness only ran chat-panel.js, so every chat-panel spec threw "Cannot destructure property 'findMentionQuery' of 'globalThis.NanocoderMentionUtils' as it is undefined" — 28 failures on main and on every PR branched from it. Run mention-utils.js in the same VM context first, matching the load order chat-webview-provider.ts already uses.
addyCooks
requested review from
Avtrkrb,
akramcodez and
will-lamerton
as code owners
August 18, 2026 09:22
Contributor
No changeset foundThis PR does not add a changeset, so it will not appear in the changelog or trigger a release. If the change is user-facing, add one: pnpm changesetPick a bump (patch / minor / major) and write the changelog entry in our usual voice ("Added X... Thanks to @you. Closes #123."), then commit the generated If this PR is docs-only or a chore that needs no release note, you can ignore this - or run |
18 tasks
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.
Description
chat-panel.jsdestructuresglobalThis.NanocoderMentionUtils, whichmedia/mention-utils.jsdefines. The webview loads both scripts in that order (
chat-webview-provider.ts:486,489), butsource/vscode/chat-panel-harness.tsonly ranchat-panel.jssocreatePanel()threw beforeany assertion could run:
That is 28 failures
chat-panel-thoughts(13) andchat-panel-tool-cards(15) — onmainand on every branch cut from it. The harness was missed when the mention helpers were split out
into their own script in #842;
mention-utils.jseven documents the contract in its header("Loaded as a plain script before chat-panel.js").
Runs
mention-utils.jsin the same VM context first, matching the load order the webviewalready uses. One file, +8 lines.
Type of Change
Changeset
pnpm changeset) describing this change for the changelogTesting
Automated Tests
.spec.ts/tsxfilespnpm test:allcompletes successfully)Manual Testing
Checklist