Skip to content

feat(js-sdk): run the vitest unit suite on Deno - #1585

Merged
mishushakov merged 2 commits into
mainfrom
add-deno-test-suite
Jul 23, 2026
Merged

feat(js-sdk): run the vitest unit suite on Deno#1585
mishushakov merged 2 commits into
mainfrom
add-deno-test-suite

Conversation

@mishushakov

@mishushakov mishushakov commented Jul 23, 2026

Copy link
Copy Markdown
Member

Description

pnpm test:deno now runs the full vitest suite — the unit and connectionConfig projects, 421 sandbox/files/commands/pty/git/api/config tests — under the Deno runtime via deno run -A npm:vitest run --project unit --project connectionConfig, replacing the previous single dist-based smoke test (superseded — the suite covers the SDK under Deno far more thoroughly). The CI step runs on ubuntu only and covers the same projects as the Bun suite step from #1584, and the Deno pin is bumped from 1.46.3 to 2.8.1 (setup-deno@v2) since vitest needs Deno 2's Node compat.

Also drops the edge vitest project: tests/runtimes/edge/ no longer exists, so it matched zero files.

Rebased on main after #1584: the off-Node fetch-caching fix originally in this PR was superseded by #1584's late-binding fix, which also makes the whole suite (including the per-proxy cache tests) pass under Deno with no test changes — so this PR is pure test/CI wiring.

Verified locally on Deno 2.8.1: unit project green (349 passed, 0 failed, 29 skipped — same skips as Node), connectionConfig project green (43 passed), and Node suite green.

Usage

cd packages/js-sdk
pnpm test:deno

🤖 Generated with Claude Code

@cla-bot cla-bot Bot added the cla-signed label Jul 23, 2026
@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: b0d838d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@cursor

cursor Bot commented Jul 23, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Test and CI wiring only; no production SDK runtime behavior changes.

Overview
pnpm test:deno now runs vitest’s unit and connectionConfig projects via deno run -A npm:vitest, matching test:bun, instead of the removed tests/runtimes/deno/run.test.ts dist smoke test.

CI installs Deno only on ubuntu-22.04, upgrades denoland/setup-deno to v2, and pins Deno 2.8.1 in .tool-versions. The separate edge vitest project was dropped from vitest.config.mts.

Reviewed by Cursor Bugbot for commit b0d838d. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Package Artifacts

Built from 1aea10c. Download artifacts from this workflow run.

JS SDK (e2b@2.35.3-add-deno-test-suite.0):

npm install ./e2b-2.35.3-add-deno-test-suite.0.tgz

CLI (@e2b/cli@2.14.1-add-deno-test-suite.0):

npm install ./e2b-cli-2.14.1-add-deno-test-suite.0.tgz

Python SDK (e2b==2.34.0+add.deno.test.suite):

pip install ./e2b-2.34.0+add.deno.test.suite-py3-none-any.whl

@mishushakov
mishushakov force-pushed the add-deno-test-suite branch 2 times, most recently from 782d7d3 to 58042a3 Compare July 23, 2026 11:53
@mishushakov
mishushakov marked this pull request as ready for review July 23, 2026 11:54

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Comment thread packages/js-sdk/package.json Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 58042a3c1b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/js-sdk/package.json Outdated
@mishushakov
mishushakov force-pushed the add-deno-test-suite branch from 58042a3 to e424eea Compare July 23, 2026 11:58
Comment thread packages/js-sdk/package.json Outdated
test:deno now runs the vitest unit and connectionConfig projects under
Deno (deno run -A npm:vitest run --project unit --project
connectionConfig), replacing the previous single dist-based smoke test
(superseded - the suite covers the SDK under Deno far more thoroughly).
CI runs it on ubuntu only, matching the Bun suite step. Bump the Deno
pin to 2.8.1 (setup-deno@v2) since vitest needs Deno 2's Node compat.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mishushakov
mishushakov force-pushed the add-deno-test-suite branch from e424eea to 4778135 Compare July 23, 2026 12:03
@mishushakov
mishushakov enabled auto-merge (squash) July 23, 2026 12:04
@mishushakov
mishushakov disabled auto-merge July 23, 2026 12:06
tests/runtimes/edge/ no longer exists, so the project matched zero
files and only added noise to vitest run output.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mishushakov
mishushakov merged commit e29d406 into main Jul 23, 2026
30 checks passed
@mishushakov
mishushakov deleted the add-deno-test-suite branch July 23, 2026 12:22
mishushakov added a commit that referenced this pull request Jul 23, 2026
## What

Extends the Deno vitest run (#1585) with the `template` project and
fixes the real runtime bug the suite surfaced. Split out of #1594 (Bun
counterpart: #1596).

```jsonc
// packages/js-sdk/package.json
"test:deno": "deno run -A npm:vitest run --project unit --project connectionConfig --project template",
```

## Bug — Deno: template uploads used chunked transfer encoding

Deno's native `fetch` ignores an explicit `Content-Length` header on
stream bodies and falls back to `Transfer-Encoding: chunked` — exactly
the failure #1243 fixed for Node, since S3-compatible presigned PUT URLs
reject chunked uploads with 501.

`uploadFile` now streams the spooled archive through **undici's
`fetch`** (via the existing `loadUndici()` helper — undici 8 where it
imports, undici 7 on Bun, global `fetch` where undici isn't resolvable,
e.g. bundled apps), which honors the `Content-Length` header on stream
bodies on every runtime. One upload path, no runtime sniffing.

Approaches rejected along the way, all verified empirically with 1GB
uploads + RSS sampling:

- **File-backed `Blob` body (`fs.openAsBlob`)** — lazy on Node/Bun, but
Deno's shim reads the whole file into memory eagerly
(denoland/deno#32316), and Bun infers an unstrippable MIME type from the
extension whose `Content-Type` breaks presigned signatures (403 against
production storage).
- **`node:http(s)` on Deno** — works (and is memory-bounded), but can't
be unified: Bun's `node:http` ignores abort signals, and it's a second
code path.

Known caveat: Deno's `Readable.toWeb` shim has no backpressure, so the
archive is buffered in memory during upload on Deno (Node and Bun stream
in lockstep with the socket). Filed upstream as denoland/deno#36275 —
accepted as Deno's to fix rather than worked around here.

As part of this, `tarFileStream` became `spoolTarArchive`, returning `{
path, size, cleanup }` with caller-owned cleanup instead of a
self-deleting read stream. `tests/template/uploadFile.test.ts` also
asserts no `Content-Type` header is sent.

## Python SDK parity

Intentionally none: `upload_file` already sends a sized file body via
httpx.

## Testing

- Real template builds (`tests/template/build.test.ts`, against prod S3
presigned URLs) green under **Node, Deno, and Bun**
- `uploadFile` + `spoolTarArchive` suites green under Node, Deno, and
Bun
- `tests/template/abortSignal.test.ts` green under Deno
- `pnpm build`, `lint`, `typecheck`, `prettier --check` clean

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants