Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

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

Mish Ushakove29d406887fe
diff --git a/.github/workflows/js_sdk_tests.yml b/.github/workflows/js_sdk_tests.yml
index 52c17f5c2..c322ae040 100644
--- a/.github/workflows/js_sdk_tests.yml
+++ b/.github/workflows/js_sdk_tests.yml
@@ -108,11 +108,13 @@ jobs:
E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }}
- name: Install Deno
- uses: denoland/setup-deno@v1
+ if: matrix.os == 'ubuntu-22.04'
+ uses: denoland/setup-deno@v2
with:
deno-version: v${{ env.TOOL_VERSION_DENO }}
- - name: Run Deno tests
+ - name: Run test suite under Deno
+ if: matrix.os == 'ubuntu-22.04'
run: pnpm test:deno
env:
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
diff --git a/.tool-versions b/.tool-versions
index fc98f2e0a..430e41813 100644
--- a/.tool-versions
+++ b/.tool-versions
@@ -1,4 +1,4 @@
-deno 1.46.3
+deno 2.8.1
nodejs 22.18.0
pnpm 9.15.5
python 3.10
diff --git a/packages/js-sdk/package.json b/packages/js-sdk/package.json
index 9245868ba..459061d06 100644
--- a/packages/js-sdk/package.json
+++ b/packages/js-sdk/package.json
@@ -40,7 +40,7 @@
"test:bun": "bunx --bun vitest run --project unit --project connectionConfig",
"test:cf": "vitest run --config tests/runtimes/cloudflare/vitest.config.mts",
"test:cf:deploy": "vitest run --config tests/runtimes/cloudflare-deploy/vitest.config.mts",
- "test:deno": "deno test tests/runtimes/deno/ --allow-net --allow-read --allow-env --unstable-sloppy-imports --trace-leaks",
+ "test:deno": "deno run -A npm:vitest run --project unit --project connectionConfig",
"test:integration": "E2B_INTEGRATION_TEST=1 vitest run tests/integration/**",
"typecheck": "tsc --noEmit",
"lint": "oxlint --config ../../.oxlintrc.json src tests",
diff --git a/packages/js-sdk/tests/runtimes/deno/run.test.ts b/packages/js-sdk/tests/runtimes/deno/run.test.ts
deleted file mode 100644
index 9f9d35c34..000000000
--- a/packages/js-sdk/tests/runtimes/deno/run.test.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import {
- assert,
- assertEquals,
-} from 'https://deno.land/[email protected]/assert/mod.ts'
-import { load } from 'https://deno.land/[email protected]/dotenv/mod.ts'
-
-await load({ envPath: '.env', export: true })
-
-import { Sandbox } from '../../../dist/index.mjs'
-import { template } from '../../template'
-
-Deno.test('Deno test', async () => {
- const sbx = await Sandbox.create(template, { timeoutMs: 5_000 })
- try {
- const isRunning = await sbx.isRunning()
- assert(isRunning)
-
- const text = 'Hello, World!'
-
- const cmd = await sbx.commands.run(`echo "${text}"`)
-
- assertEquals(cmd.exitCode, 0)
- assertEquals(cmd.stdout, `${text}\n`)
- } finally {
- await sbx.kill()
- }
-})
diff --git a/packages/js-sdk/vitest.config.mts b/packages/js-sdk/vitest.config.mts
index 39a5034ac..ee1c73487 100644
--- a/packages/js-sdk/vitest.config.mts
+++ b/packages/js-sdk/vitest.config.mts
@@ -53,13 +53,6 @@ export default defineConfig({
},
},
},
- {
- test: {
- include: ['tests/runtimes/edge/**/*.{test,spec}.ts'],
- name: 'edge',
- environment: 'edge-runtime',
- },
- },
{
test: {
name: 'integration',