Repository navigation
feat(vitest): add standalone @argos-ci/vitest package - #337
Merged
Merged
Conversation
Extract the generic Vitest browser-mode screenshot machinery out of
@argos-ci/storybook into a new @argos-ci/vitest package that works
standalone and is reused by the storybook package.
- New package @argos-ci/vitest with:
- browser API `argosScreenshot(name, options?)` (entry `.`)
- `argosVitestPlugin` (entry `./plugin`) registering the browser
command and the upload reporter
- shared iframe utils + `screenshotFrame` primitive (entry
`./internal`) consumed by storybook
- Move ArgosReporter and the iframe DOM ops (tester-scale reset,
iframe viewport resize, grow-to-fit) verbatim; storybook now imports
them instead of inlining copies.
- Keep every storybook published export byte-for-byte compatible;
rename its internal browser command key to `argosStorybookScreenshot`
to avoid the `vitest/browser` BrowserCommands augmentation clash.
- Align storybook to the catalog `@types/node` so a single vitest
peer instance is resolved across packages.
- Add unit + browser e2e tests, docs, and an e2e-vitest CI job.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The Vitest reporter called `upload()` without a `files` glob, so it fell
back to the default `**/*.{png,jpg,jpeg}` and never uploaded the
`.aria.yml` files produced by `ariaSnapshot: true`. Default the glob to
`["**/*.png", "**/*.aria.yml"]` (matching the Playwright reporter) while
still letting the config override it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This branch was successfully deployed
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.
Summary
Extracts the generic Vitest browser-mode screenshot machinery out of
@argos-ci/storybookinto a new@argos-ci/vitestpackage that works standalone and is reused by the storybook package. The goal: take Argos screenshots while Vitest runs browser tests.What's in the package
.(browser):argosScreenshot(name, options?)+ thevitest/browsercommand augmentation. Node-free (onlyimport type+ a lazyimport("vitest/browser"))../plugin(node):argosVitestPlugin— registers the browser command and the upload reporter../internal(node, unstable): shared iframe utils +screenshotFrameprimitive consumed by storybook.The
ArgosReporterand the iframe DOM ops (tester-scale reset, iframe viewport resize, grow-to-fit) were moved verbatim; storybook now imports them instead of inlining copies.Design notes
Locators go on the plugin (node side) and are merged in the command closure.@argos-ci/storybookpublished export is unchanged. Its internal browser command key was renamedargosScreenshot→argosStorybookScreenshotto avoid avitest/browserBrowserCommandsaugmentation clash. The publicargosScreenshot(story, name)function name is kept.@types/node, so itsvitestpeer resolved to v26 while the catalog pins v22 — twovitest/nodeinstances meant the@vitest/browser-playwrightctx.page/frameaugmentation didn't apply cross-package. Aligned storybook to the catalog@types/node.Tests
server.commands.readFileto assert metadata (sdk=@argos-ci/vitest,automationLibrary=@vitest/browser-playwright, per-viewportviewport),ariaSnapshotforwarding, and the horizontalfitWidthpath via PNG-width decode.e2e-vitestCI job;.prettierignorescoped to/packages/*/{test-results,screenshots}.Verification
turbo run check-types lint check-format test→ 53/53 tasks green.🤖 Generated with Claude Code