test(preview): add component coverage for every fixture lifecycle state - #91
Merged
Conversation
Preview rendered lifecycle states with no component coverage, so status semantics, diagnostics, and the sandboxed frame could regress without reaching the root test gate. Add component tests driven by an injected fake PreviewClient and run the package suite under Vitest so JSX and the app Vite pipeline are shared. Closes #53. Co-Authored-By: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
apps/previewrendered its lifecycle states with no component coverage, so status semantics, diagnostic visibility, and the sandbox posture could regress without reaching the root test gate.src/preview-app.test.tsxcovers the four states named in the issue — no-project, loading, build-unavailable, and runtime-error — plus the ready and retained-last-good states the app has grown since. All are driven by an injected fakePreviewClient; no runtime, network, or generated build is involved.role=statusvsrole=alerton the right panel, matchingaria-livepoliteness, structured diagnostic visibility, and that each state is distinguishable by its status text rather than colour alone.sandbox=allow-scriptswithreferrerpolicy=no-referrer, and the escape routes out of a broken state are real keyboard-focusable links.New test dependency
The package
testscript becomesvitest run. Preview is a Vite app and its components are.tsx;node --experimental-strip-typescannot strip JSX, so the existing barenode --testrunner cannot load them. Vitest reuses the app's own Vite transform pipeline instead of adding a second one.Three dev-only dependencies:
vitest,jsdom,@testing-library/react. None are bundled.preview-client.test.tskeeps itsnode:assert/strictassertions and only swaps itstestimport; its source-reading assertion now resolves viaimport.meta.dirname. Rationale is documented in the newapps/preview/README.md.Validation
pnpm --filter @universal/preview test(15 passing)pnpm --filter @universal/preview typecheckpnpm --filter @universal/preview lintpnpm --filter @universal/preview buildpnpm format:checkNo visible behaviour changed; this PR adds tests, a README, and the test runner only.
Closes #53.
🤖 Generated with Claude Code