Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Fix local JS tests

Tomas Valentae5e65f378ed3
diff --git a/packages/js-sdk/src/api/schema.gen.ts b/packages/js-sdk/src/api/schema.gen.ts
index def96599c..62a662f38 100644
--- a/packages/js-sdk/src/api/schema.gen.ts
+++ b/packages/js-sdk/src/api/schema.gen.ts
@@ -322,7 +322,7 @@ export interface components {
*/
MemoryMB: number;
NewSandbox: {
- envVars?: components["schemas"]["SandboxMetadata"];
+ envVars?: components["schemas"]["EnvVars"];
metadata?: components["schemas"]["SandboxMetadata"];
/** @description Identifier of the required template */
templateID: string;
diff --git a/packages/js-sdk/tests/sandbox/commands/envVars.test.ts b/packages/js-sdk/tests/sandbox/commands/envVars.test.ts
index 9cc6fef7d..c94b5c712 100644
--- a/packages/js-sdk/tests/sandbox/commands/envVars.test.ts
+++ b/packages/js-sdk/tests/sandbox/commands/envVars.test.ts
@@ -1,16 +1,16 @@
import { assert } from 'vitest'
-import { sandboxTest } from '../../setup.js'
+import { sandboxTest, isDebug } from '../../setup.js'
import { Sandbox } from '../../../src'
-sandboxTest('env vars', async ({ sandbox }) => {
+sandboxTest.skipIf(isDebug)('env vars', async ({ sandbox }) => {
const cmd = await sandbox.commands.run('echo $FOO', { envs: { FOO: 'bar' } })
assert.equal(cmd.exitCode, 0)
assert.equal(cmd.stdout.trim(), 'bar')
})
-sandboxTest('env vars on sandbox', async () => {
+sandboxTest.skipIf(isDebug)('env vars on sandbox', async () => {
const sandbox = await Sandbox.create({ envs: { FOO: 'bar' } })
const cmd = await sandbox.commands.run('echo "$FOO"')
diff --git a/packages/js-sdk/tests/sandbox/connect.test.ts b/packages/js-sdk/tests/sandbox/connect.test.ts
index 5dc09fa21..7311713a3 100644
--- a/packages/js-sdk/tests/sandbox/connect.test.ts
+++ b/packages/js-sdk/tests/sandbox/connect.test.ts
@@ -1,7 +1,7 @@
import { test, assert } from 'vitest'
import { Sandbox } from '../../src'
-import { template } from '../setup.js'
+import { isDebug, template } from '../setup.js'
test('connect', async () => {
const sbx = await Sandbox.create(template, { timeoutMs: 10_000 })
@@ -14,6 +14,8 @@ test('connect', async () => {
const isRunning2 = await sbxConnection.isRunning()
assert.isTrue(isRunning2)
} finally {
- await sbx.kill()
+ if (!isDebug) {
+ await sbx.kill()
+ }
}
})
diff --git a/packages/js-sdk/tests/sandbox/files/list.test.ts b/packages/js-sdk/tests/sandbox/files/list.test.ts
index 93f70c76a..448417f48 100644
--- a/packages/js-sdk/tests/sandbox/files/list.test.ts
+++ b/packages/js-sdk/tests/sandbox/files/list.test.ts
@@ -3,14 +3,14 @@ import { assert } from 'vitest'
import { sandboxTest } from '../../setup.js'
sandboxTest('list directory', async ({ sandbox }) => {
- const dirName = 'test_directory'
+ const dirName = 'test_directory4'
await sandbox.files.makeDir(dirName)
const files = await sandbox.files.list(dirName)
assert.equal(files.length, 0)
- await sandbox.files.write('test_directory/test_file', 'test')
+ await sandbox.files.write('test_directory4/test_file', 'test')
const files1 = await sandbox.files.list(dirName)
assert.equal(files1.length, 1)
diff --git a/packages/js-sdk/tests/sandbox/files/makeDir.test.ts b/packages/js-sdk/tests/sandbox/files/makeDir.test.ts
index c4f15960c..87759bc91 100644
--- a/packages/js-sdk/tests/sandbox/files/makeDir.test.ts
+++ b/packages/js-sdk/tests/sandbox/files/makeDir.test.ts
@@ -3,7 +3,7 @@ import { assert } from 'vitest'
import { sandboxTest } from '../../setup.js'
sandboxTest('make directory', async ({ sandbox }) => {
- const dirName = 'test_directory'
+ const dirName = 'test_directory1'
await sandbox.files.makeDir(dirName)
const exists = await sandbox.files.exists(dirName)
@@ -11,7 +11,7 @@ sandboxTest('make directory', async ({ sandbox }) => {
})
sandboxTest('make existing directory', async ({ sandbox }) => {
- const dirName = 'test_directory'
+ const dirName = 'test_directory2'
await sandbox.files.makeDir(dirName)
const exists = await sandbox.files.exists(dirName)
@@ -22,7 +22,7 @@ sandboxTest('make existing directory', async ({ sandbox }) => {
})
sandboxTest('make nested directory', async ({ sandbox }) => {
- const nestedDirName = 'test_directory/nested_directory'
+ const nestedDirName = 'test_directory3/nested_directory'
await sandbox.files.makeDir(nestedDirName)
const exists = await sandbox.files.exists(nestedDirName)