feat(ct): type mount() story ids through a generated Stories registry - #42518
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
`@playwright/test` now exports an empty `Stories` interface. When a story id is a key of it, `mount(id, props)` types the props (and `update()`) from that entry, unregistered ids keep untyped props, and the explicit `mount<typeof Story>(id, props)` form keeps working. A small Vite plugin next to the html-reporter gallery generates `stories.d.ts`, one `StoriesOf<'<package>/<path>', typeof import(...)>` line per story file, and augments `Stories` with it. Ids are prefixed with the package name so registries from several packages can share one TypeScript program. The gallery moves to `packages/html-reporter/tests`. The component testing skill documents both typing forms and ships the plugin as a reference. Fixes: microsoft#42083
900f1e0 to
f9e8340
Compare
Test results for "tests 1"6 flaky51326 passed, 1247 skipped Merge workflow run. |
Test results for "MCP"1 failed 8274 passed, 1371 skipped Merge workflow run. |
🟢 The one failure is a pre-existing flake — this PR is clearHi, I'm the Playwright bot and I took a look at the failing CI on this PR. Only DetailsOverall: 43 of 44 checks green. The lone red is one MCP test on Chrome, in a code path the diff doesn't reach. No caused-by-PR failures. Pre-existing flake / infra
A re-run of the Chrome MCP job should go green. Triaged by the Playwright bot - agent run |
bfb42e5
into
microsoft:main
Summary
@playwright/testexports an emptyStoriesinterface;mount(id, props)types props andupdate()fromStories[id]when the id is registered, keeps untyped props otherwise, and the explicitmount<typeof Story>(id, props)form still works.stories.d.ts(one line per story file, ids prefixed with the package name) and augmentsStories; the gallery moves topackages/html-reporter/tests.Fixes #42083