test(webmcp-polyfill): add browser-mode Vitest config & declarative DOM tool support - #145
Open
MiguelsPizza wants to merge 1 commit into
Open
Conversation
MiguelsPizza
force-pushed
the
codex/polyfill-declarative-api-using-conformance-testing
branch
from
March 4, 2026 20:22
887ebbc to
da3f3a6
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Motivation
navigator,document) and need a browser-mode Vitest path to run conformance-style tests reliably.Description
packages/webmcp-polyfill/vitest.browser.config.tswired to Playwright/Chromium and addedtest:browser/test:browser:uiscripts inpackages/webmcp-polyfill/package.jsonso browser-mode runs are explicit and opt-in.packages/webmcp-polyfill/package.jsonand updatedpnpm-lock.yamlto include@vitest/browser,@vitest/browser-playwright, andplaywrightentries.packages/webmcp-polyfill/src/index.ts(parse scripts of typeapplication/webmcp+json,[data-webmcp-tool]elements,startDeclarativeToolSyncwithMutationObserver, integration intoinitializeWebMCPPolyfilland cleanup logic, and exposing serialized cross-document results to the testing shim).packages/webmcp-polyfill/src/index.test.tsto assert parsing of declarative<script>entries anddata-webmcp-toolelements and that declarative registrations are synchronized when DOM nodes are removed.Testing
pnpm --filter @mcp-b/webmcp-polyfill buildand the build completed successfully (tsdown/tsc step passed).pnpm --filter @mcp-b/webmcp-polyfill test(Node-mode Vitest) and observed failures because the suite expects browser globals (navigator,document) in this environment; the Node-only run reported many failing tests (navigator is not defined).pnpm --filter @mcp-b/webmcp-polyfill test:browserwhich starts Vitest in browser mode, but the run could not complete because Playwright Chromium is not available in this environment andplaywright install chromiumfailed (browser download blocked by network:403 Domain forbidden).pnpm --filter @mcp-b/webmcp-polyfill exec playwright install chromiumand received a network/download failure preventing browser installation; this prevents executing the browser-mode tests here but the project is now wired so CI with an available Chromium (or allowed Playwright downloads) can run the conformance suite.Codex Task