- Add @vercel/sandbox-mock, a drop-in mock for @vercel/sandbox backed by just-bash that runs the real @vercel/sandbox classes against an in-memory implementation of the /v2/sandboxes HTTP API
- Snapshot.get now forwards a custom fetch via WithFetchOptions, matching Snapshot.list and Snapshot.tree behavior
From Vercel Sandbox
Patch Changes
-
Add
@vercel/sandbox-mock, a drop-in mock for@vercel/sandboxbacked byjust-bash. Rather than reimplementing the SDK surface, it runs the real@vercel/sandboxclasses against an in-memory implementation of the/v2/sandboxesHTTP API injected through the SDK'sfetchseam — so command execution, filesystem, multi-user/group management, snapshots, and forking all exercise the real SDK code. Commands run locally viajust-bashagainst an in-memory filesystem, andcommand()/setupSandbox()let tests stub the output of commandsjust-bashcan't run. (#245)As part of this,
Snapshot.getnow forwards a customfetch(viaWithFetchOptions), matchingSnapshot.listandSnapshot.tree. Previously it always used the globalfetch, so an injected client — such as the mock — could not intercept the request.