feat(e2e): in-process fake blob server so tests exercise the real paths#38
Merged
Conversation
Previously the CI dev server logged 'BLOB_READ_WRITE_TOKEN is not set' on every tripwire-touching test because there's no token in the CI environment. The tests passed only because errors landed inside an error boundary or a fire-and-forget catch — the blob code paths weren't actually exercised. This adds a tiny in-memory HTTP server (e2e/fake-blob.ts) that Playwright runs as a second webServer alongside `next dev`. The fake honors the subset of the Vercel Blob surface we actually use: PUT a pathname, GET it back, and a GET /api/blob/ list endpoint for ingest. It seeds stats/tripwire-aggregates.json from a fixture so /x/tripwire renders real numbers. Production code stays on @vercel/blob. A new src/lib/blob.ts wrapper routes put() to the SDK in prod and to the fake's HTTP PUT when BLOB_BASE_URL is set. aggregates.ts and ingest.ts gain one-line overrides on the URL builders. A new e2e/x/tripwire/page.spec.ts loads /x/tripwire and asserts the hero numbers match the seeded fixture, proving the read path end-to- end.
|
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
CI was logging `BLOB_READ_WRITE_TOKEN is not set` on every tripwire-touching test because there's no token in the CI environment. Tests still passed (errors caught by Suspense boundaries or fire-and-forget catches), but the blob code paths weren't actually exercised — so a real regression in the read or write path would have slipped through.
This adds an in-memory HTTP server (`e2e/fake-blob.ts`) that Playwright runs as a second `webServer` alongside `next dev`. The fake honors the subset of the Vercel Blob surface we use: `PUT /`, `GET /`, and `GET /api/blob/?prefix=` for ingest's list call. It seeds `stats/tripwire-aggregates.json` from a fixture so `/x/tripwire` renders real numbers.
Production stays on `@vercel/blob`. A new `src/lib/blob.ts` wrapper routes `put()` to the SDK in prod and to the fake's HTTP PUT when `BLOB_BASE_URL` is set. `aggregates.ts` and `ingest.ts` got one-line overrides on their URL builders.
A new `e2e/x/tripwire/page.spec.ts` loads `/x/tripwire` and asserts the hero numbers match the seeded fixture, proving the read path end-to-end.
Local verification