Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Improve CI/CD speed for template tests (#1035)

Mish Ushakovd911c55c3e90
diff --git a/.github/workflows/js_sdk_tests.yml b/.github/workflows/js_sdk_tests.yml
index 31e58a32f..b4b83c72b 100644
--- a/.github/workflows/js_sdk_tests.yml
+++ b/.github/workflows/js_sdk_tests.yml
@@ -58,6 +58,24 @@ jobs:
run: |
pnpm install --frozen-lockfile
+ - name: Cache Playwright binaries (Linux)
+ if: matrix.os == 'ubuntu-22.04'
+ uses: actions/cache@v4
+ with:
+ path: ~/.cache/ms-playwright
+ key: playwright-${{ runner.os }}-${{ env.TOOL_VERSION_NODEJS }}-${{ hashFiles('packages/js-sdk/package.json') }}
+ restore-keys: |
+ playwright-${{ runner.os }}-${{ env.TOOL_VERSION_NODEJS }}-
+
+ - name: Cache Playwright binaries (Windows)
+ if: matrix.os == 'windows-latest'
+ uses: actions/cache@v4
+ with:
+ path: ~/AppData/Local/ms-playwright
+ key: playwright-${{ runner.os }}-${{ env.TOOL_VERSION_NODEJS }}-${{ hashFiles('packages/js-sdk/package.json') }}
+ restore-keys: |
+ playwright-${{ runner.os }}-${{ env.TOOL_VERSION_NODEJS }}-
+
- name: Test build
run: pnpm build
diff --git a/packages/js-sdk/package.json b/packages/js-sdk/package.json
index 2eae133e3..b4bff4293 100644
--- a/packages/js-sdk/package.json
+++ b/packages/js-sdk/package.json
@@ -57,6 +57,7 @@
"eslint": "^8.57.1",
"json-schema-to-typescript": "^15.0.4",
"knip": "^5.43.6",
+ "msw": "^2.12.3",
"npm-check-updates": "^16.14.20",
"npm-run-all": "^4.1.5",
"openapi-typescript": "^7.9.1",
diff --git a/packages/js-sdk/tests/setup.ts b/packages/js-sdk/tests/setup.ts
index 9928b3aa4..5d6766440 100644
--- a/packages/js-sdk/tests/setup.ts
+++ b/packages/js-sdk/tests/setup.ts
@@ -20,18 +20,18 @@ interface SandboxFixture {
interface BuildTemplateFixture {
buildTemplate: (
template: TemplateClass,
- options?: { skipCache?: boolean },
+ options?: { alias?: string; skipCache?: boolean },
onBuildLogs?: (logEntry: LogEntry) => void
) => Promise<BuildInfo>
}
function buildTemplate(
template: TemplateClass,
- options?: { skipCache?: boolean },
+ options?: { alias?: string; skipCache?: boolean },
onBuildLogs?: (logEntry: LogEntry) => void
) {
return Template.build(template, {
- alias: `e2b-test-${randomUUID()}`,
+ alias: options?.alias || `e2b-test-${randomUUID()}`,
cpuCount: 1,
memoryMB: 1024,
skipCache: options?.skipCache,
diff --git a/packages/js-sdk/tests/template/build.test.ts b/packages/js-sdk/tests/template/build.test.ts
index dfeb3e084..241e8f172 100644
--- a/packages/js-sdk/tests/template/build.test.ts
+++ b/packages/js-sdk/tests/template/build.test.ts
@@ -29,7 +29,8 @@ afterAll(() => {
buildTemplateTest('build template', async ({ buildTemplate }) => {
const template = Template()
- .fromImage('ubuntu:22.04')
+ // using base image to avoid re-building ubuntu:22.04 image
+ .fromBaseImage()
.copy('folder/*', 'folder', { forceUpload: true })
.runCmd('cat folder/test.txt')
.setWorkdir('/app')
@@ -38,6 +39,14 @@ buildTemplateTest('build template', async ({ buildTemplate }) => {
await buildTemplate(template, { skipCache: true }, defaultBuildLogger())
})
+buildTemplateTest(
+ 'build template from base template',
+ async ({ buildTemplate }) => {
+ const template = Template().fromTemplate('base')
+ await buildTemplate(template, { skipCache: true })
+ }
+)
+
buildTemplateTest('build template with symlinks', async ({ buildTemplate }) => {
const template = Template()
.fromImage('ubuntu:22.04')
@@ -63,11 +72,3 @@ buildTemplateTest(
await buildTemplate(template)
}
)
-
-buildTemplateTest(
- 'build template with skipCache',
- async ({ buildTemplate }) => {
- const template = Template().skipCache().fromImage('ubuntu:22.04')
- await buildTemplate(template)
- }
-)
diff --git a/packages/js-sdk/tests/template/methods/aptInstall.test.ts b/packages/js-sdk/tests/template/methods/aptInstall.test.ts
index 42c401d7c..3e4ad777a 100644
--- a/packages/js-sdk/tests/template/methods/aptInstall.test.ts
+++ b/packages/js-sdk/tests/template/methods/aptInstall.test.ts
@@ -5,7 +5,7 @@ buildTemplateTest('apt install', async ({ buildTemplate }) => {
const template = Template()
.fromImage('ubuntu:24.04')
.skipCache()
- .aptInstall(['vim'])
+ .aptInstall('rolldice')
await buildTemplate(template)
})
@@ -16,7 +16,7 @@ buildTemplateTest(
const template = Template()
.fromImage('ubuntu:24.04')
.skipCache()
- .aptInstall(['vim'], { noInstallRecommends: true })
+ .aptInstall('rolldice', { noInstallRecommends: true })
await buildTemplate(template)
}
diff --git a/packages/js-sdk/tests/template/methods/bunInstall.test.ts b/packages/js-sdk/tests/template/methods/bunInstall.test.ts
index 6630784a6..4fe3b3738 100644
--- a/packages/js-sdk/tests/template/methods/bunInstall.test.ts
+++ b/packages/js-sdk/tests/template/methods/bunInstall.test.ts
@@ -5,7 +5,7 @@ buildTemplateTest('bun install', async ({ buildTemplate }) => {
const template = Template()
.fromBunImage('1.3')
.skipCache()
- .bunInstall(['lodash', 'axios'])
+ .bunInstall('left-pad')
await buildTemplate(template)
})
@@ -14,7 +14,7 @@ buildTemplateTest('bun install global', async ({ buildTemplate }) => {
const template = Template()
.fromBunImage('1.3')
.skipCache()
- .bunInstall(['tsx'], { g: true })
+ .bunInstall('left-pad', { g: true })
await buildTemplate(template)
})
@@ -23,7 +23,7 @@ buildTemplateTest('bun install dev', async ({ buildTemplate }) => {
const template = Template()
.fromBunImage('1.3')
.skipCache()
- .bunInstall(['typescript'], { dev: true })
+ .bunInstall('left-pad', { dev: true })
await buildTemplate(template)
})
diff --git a/packages/js-sdk/tests/template/methods/fromDockerfile.test.ts b/packages/js-sdk/tests/template/methods/fromDockerfile.test.ts
new file mode 100644
index 000000000..abf0d090f
--- /dev/null
+++ b/packages/js-sdk/tests/template/methods/fromDockerfile.test.ts
@@ -0,0 +1,126 @@
+import { buildTemplateTest } from '../../setup'
+import { Template } from '../../../src'
+import { InstructionType } from '../../../src/template/types'
+import { assert } from 'vitest'
+
+buildTemplateTest('fromDockerfile', async () => {
+ const dockerfile = `FROM node:24
+WORKDIR /app
+COPY package.json .
+RUN npm install`
+
+ const template = Template().fromDockerfile(dockerfile)
+
+ assert.equal(
+ // @ts-expect-error - baseImage is not a property of TemplateBuilder
+ template.baseImage,
+ 'node:24'
+ )
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[1].type,
+ InstructionType.WORKDIR
+ )
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[1].args[0],
+ '/'
+ )
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[2].type,
+ InstructionType.WORKDIR
+ )
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[2].args[0],
+ '/app'
+ )
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[3].type,
+ InstructionType.COPY
+ )
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[3].args[0],
+ 'package.json'
+ )
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[3].args[1],
+ '.'
+ )
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[4].type,
+ InstructionType.RUN
+ )
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[4].args[0],
+ 'npm install'
+ )
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[5].type,
+ InstructionType.USER
+ )
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[5].args[0],
+ 'user'
+ )
+})
+
+buildTemplateTest('fromDockerfile with default user and workdir', () => {
+ const dockerfile = 'FROM node:24'
+ const template = Template().fromDockerfile(dockerfile)
+
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[template.instructions.length - 2].type,
+ InstructionType.USER
+ )
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[template.instructions.length - 2].args[0],
+ 'user'
+ )
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[template.instructions.length - 1].type,
+ InstructionType.WORKDIR
+ )
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[template.instructions.length - 1].args[0],
+ '/home/user'
+ )
+})
+
+buildTemplateTest('fromDockerfile with custom user and workdir', () => {
+ const dockerfile = 'FROM node:24\nUSER mish\nWORKDIR /home/mish'
+ const template = Template().fromDockerfile(dockerfile)
+
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[template.instructions.length - 2].type,
+ InstructionType.USER
+ )
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[template.instructions.length - 2].args[0],
+ 'mish'
+ )
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[template.instructions.length - 1].type,
+ InstructionType.WORKDIR
+ )
+ assert.equal(
+ // @ts-expect-error - instructions is not a property of TemplateBuilder
+ template.instructions[template.instructions.length - 1].args[0],
+ '/home/mish'
+ )
+})
diff --git a/packages/js-sdk/tests/template/methods/fromMethods.test.ts b/packages/js-sdk/tests/template/methods/fromMethods.test.ts
deleted file mode 100644
index 48e2024eb..000000000
--- a/packages/js-sdk/tests/template/methods/fromMethods.test.ts
+++ /dev/null
@@ -1,148 +0,0 @@
-import { buildTemplateTest } from '../../setup'
-import { Template } from '../../../src'
-import { InstructionType } from '../../../src/template/types'
-import path from 'node:path'
-import fs from 'node:fs'
-import { afterAll, beforeAll, assert } from 'vitest'
-
-const fileContextPath = path.join(__dirname, 'dockerfile-context')
-
-beforeAll(async () => {
- fs.mkdirSync(fileContextPath, { recursive: true })
- fs.writeFileSync(
- path.join(fileContextPath, 'package.json'),
- JSON.stringify({ name: 'my-app', version: '1.0.0' }, null, 2),
- 'utf-8'
- )
-})
-
-afterAll(async () => {
- fs.rmSync(fileContextPath, { recursive: true, force: true })
-})
-
-buildTemplateTest('fromBaseImage', async ({ buildTemplate }) => {
- const template = Template().fromBaseImage()
- await buildTemplate(template, { skipCache: true })
-})
-
-buildTemplateTest('fromDebianImage', async ({ buildTemplate }) => {
- const template = Template().fromDebianImage()
- await buildTemplate(template, { skipCache: true })
-})
-
-buildTemplateTest('fromDebianImage with variant', async ({ buildTemplate }) => {
- const template = Template().fromDebianImage('bookworm')
- await buildTemplate(template, { skipCache: true })
-})
-
-buildTemplateTest('fromUbuntuImage', async ({ buildTemplate }) => {
- const template = Template().fromUbuntuImage()
- await buildTemplate(template, { skipCache: true })
-})
-
-buildTemplateTest('fromUbuntuImage with variant', async ({ buildTemplate }) => {
- const template = Template().fromUbuntuImage('24.04')
- await buildTemplate(template, { skipCache: true })
-})
-
-buildTemplateTest('fromPythonImage', async ({ buildTemplate }) => {
- const template = Template().fromPythonImage()
- await buildTemplate(template, { skipCache: true })
-})
-
-buildTemplateTest('fromPythonImage with variant', async ({ buildTemplate }) => {
- const template = Template().fromPythonImage('3.12')
- await buildTemplate(template, { skipCache: true })
-})
-
-buildTemplateTest('fromNodeImage', async ({ buildTemplate }) => {
- const template = Template().fromNodeImage()
- await buildTemplate(template, { skipCache: true })
-})
-
-buildTemplateTest('fromNodeImage with variant', async ({ buildTemplate }) => {
- const template = Template().fromNodeImage('24')
- await buildTemplate(template, { skipCache: true })
-})
-
-buildTemplateTest('fromBunImage', async ({ buildTemplate }) => {
- const template = Template().fromBunImage()
- await buildTemplate(template, { skipCache: true })
-})
-
-buildTemplateTest('fromBunImage with variant', async ({ buildTemplate }) => {
- const template = Template().fromBunImage('1.3')
- await buildTemplate(template, { skipCache: true })
-})
-
-buildTemplateTest('fromImage', async ({ buildTemplate }) => {
- const template = Template().fromImage('ubuntu:22.04')
- await buildTemplate(template, { skipCache: true })
-})
-
-buildTemplateTest('fromTemplate', async ({ buildTemplate }) => {
- const template = Template().fromTemplate('base')
- await buildTemplate(template, { skipCache: true })
-})
-
-buildTemplateTest('fromDockerfile', async ({ buildTemplate }) => {
- const dockerfile = `FROM node:24
-WORKDIR /app
-COPY package.json .
-RUN npm install`
-
- const template = Template({ fileContextPath }).fromDockerfile(dockerfile)
- await buildTemplate(template, { skipCache: true })
-})
-
-buildTemplateTest('fromDockerfile with default user and workdir', () => {
- const dockerfile = 'FROM node:24'
- const template = Template({ fileContextPath }).fromDockerfile(dockerfile)
-
- assert.equal(
- // @ts-expect-error - instructions is not a property of TemplateBuilder
- template.instructions[template.instructions.length - 2].type,
- InstructionType.USER
- )
- assert.equal(
- // @ts-expect-error - instructions is not a property of TemplateBuilder
- template.instructions[template.instructions.length - 2].args[0],
- 'user'
- )
- assert.equal(
- // @ts-expect-error - instructions is not a property of TemplateBuilder
- template.instructions[template.instructions.length - 1].type,
- InstructionType.WORKDIR
- )
- assert.equal(
- // @ts-expect-error - instructions is not a property of TemplateBuilder
- template.instructions[template.instructions.length - 1].args[0],
- '/home/user'
- )
-})
-
-buildTemplateTest('fromDockerfile with custom user and workdir', () => {
- const dockerfile = 'FROM node:24\nUSER mish\nWORKDIR /home/mish'
- const template = Template({ fileContextPath }).fromDockerfile(dockerfile)
-
- assert.equal(
- // @ts-expect-error - instructions is not a property of TemplateBuilder
- template.instructions[template.instructions.length - 2].type,
- InstructionType.USER
- )
- assert.equal(
- // @ts-expect-error - instructions is not a property of TemplateBuilder
- template.instructions[template.instructions.length - 2].args[0],
- 'mish'
- )
- assert.equal(
- // @ts-expect-error - instructions is not a property of TemplateBuilder
- template.instructions[template.instructions.length - 1].type,
- InstructionType.WORKDIR
- )
- assert.equal(
- // @ts-expect-error - instructions is not a property of TemplateBuilder
- template.instructions[template.instructions.length - 1].args[0],
- '/home/mish'
- )
-})
diff --git a/packages/js-sdk/tests/template/methods/makeSymlink.test.ts b/packages/js-sdk/tests/template/methods/makeSymlink.test.ts
index ccc666148..67a1c816a 100644
--- a/packages/js-sdk/tests/template/methods/makeSymlink.test.ts
+++ b/packages/js-sdk/tests/template/methods/makeSymlink.test.ts
@@ -14,8 +14,8 @@ buildTemplateTest('make symlink', async ({ buildTemplate }) => {
buildTemplateTest('make symlink (force)', async ({ buildTemplate }) => {
const template = Template()
.fromImage('ubuntu:22.04')
- .skipCache()
.makeSymlink('.bashrc', '.bashrc.local')
+ .skipCache()
.makeSymlink('.bashrc', '.bashrc.local', { force: true }) // Overwrite existing symlink
.runCmd('test "$(readlink .bashrc.local)" = ".bashrc"')
diff --git a/packages/js-sdk/tests/template/methods/npmInstall.test.ts b/packages/js-sdk/tests/template/methods/npmInstall.test.ts
index 1ab14227e..e28ac61b1 100644
--- a/packages/js-sdk/tests/template/methods/npmInstall.test.ts
+++ b/packages/js-sdk/tests/template/methods/npmInstall.test.ts
@@ -5,7 +5,7 @@ buildTemplateTest('npm install', async ({ buildTemplate }) => {
const template = Template()
.fromNodeImage('24')
.skipCache()
- .npmInstall(['lodash', 'axios'])
+ .npmInstall('left-pad')
await buildTemplate(template)
})
@@ -14,7 +14,7 @@ buildTemplateTest('npm install global', async ({ buildTemplate }) => {
const template = Template()
.fromNodeImage('24')
.skipCache()
- .npmInstall(['tsx'], { g: true })
+ .npmInstall('left-pad', { g: true })
await buildTemplate(template)
})
@@ -23,7 +23,7 @@ buildTemplateTest('npm install dev', async ({ buildTemplate }) => {
const template = Template()
.fromNodeImage('24')
.skipCache()
- .npmInstall(['typescript'], { dev: true })
+ .npmInstall('left-pad', { dev: true })
await buildTemplate(template)
})
diff --git a/packages/js-sdk/tests/template/methods/pipInstall.test.ts b/packages/js-sdk/tests/template/methods/pipInstall.test.ts
index 1d20c3774..0fa6ad042 100644
--- a/packages/js-sdk/tests/template/methods/pipInstall.test.ts
+++ b/packages/js-sdk/tests/template/methods/pipInstall.test.ts
@@ -5,7 +5,7 @@ buildTemplateTest('pip install', async ({ buildTemplate }) => {
const template = Template()
.fromPythonImage('3.13.7-trixie')
.skipCache()
- .pipInstall(['six', 'pyyaml'])
+ .pipInstall('pip-install-test')
await buildTemplate(template)
})
@@ -14,7 +14,7 @@ buildTemplateTest('pip install (user)', async ({ buildTemplate }) => {
const template = Template()
.fromPythonImage('3.13.7-trixie')
.skipCache()
- .pipInstall(['six', 'pyyaml'], { g: false })
+ .pipInstall('pip-install-test', { g: false })
await buildTemplate(template)
})
diff --git a/packages/js-sdk/tests/template/stacktrace.test.ts b/packages/js-sdk/tests/template/stacktrace.test.ts
index 4463620a7..fc707bf68 100644
--- a/packages/js-sdk/tests/template/stacktrace.test.ts
+++ b/packages/js-sdk/tests/template/stacktrace.test.ts
@@ -1,11 +1,81 @@
import fs from 'node:fs'
-import { assert } from 'vitest'
+import { assert, afterAll, afterEach, beforeAll } from 'vitest'
+
+import { http, HttpResponse } from 'msw'
+import { setupServer } from 'msw/node'
+
import { Template, waitForTimeout } from '../../src'
import { buildTemplateTest } from '../setup'
+import { randomUUID } from 'node:crypto'
const __fileContent = fs.readFileSync(__filename, 'utf8') // read current file content
const nonExistentPath = '/nonexistent/path'
+// map template alias -> failed step index
+const failureMap: Record<string, number | undefined> = {
+ fromImage: 0,
+ fromTemplate: 0,
+ fromDockerfile: 0,
+ fromImageRegistry: 0,
+ fromAWSRegistry: 0,
+ fromGCPRegistry: 0,
+ copy: undefined,
+ copyItems: undefined,
+ remove: 1,
+ rename: 1,
+ makeDir: 1,
+ makeSymlink: 1,
+ runCmd: 1,
+ setWorkdir: 1,
+ setUser: 1,
+ pipInstall: 1,
+ npmInstall: 1,
+ aptInstall: 1,
+ gitClone: 1,
+ setStartCmd: 1,
+ addMcpServer: undefined,
+ betaDevContainerPrebuild: 1,
+ betaSetDevContainerStart: 1,
+}
+
+export const restHandlers = [
+ http.post('https://api.e2b.app/v3/templates', async ({ request }) => {
+ const { alias } = (await request.clone().json()) as { alias: string }
+ return HttpResponse.json({
+ buildID: randomUUID(),
+ templateID: alias,
+ })
+ }),
+ http.post(
+ 'https://api.e2b.app/v2/templates/:templateID/builds/:buildID',
+ () => {
+ return HttpResponse.json({})
+ }
+ ),
+ http.get<{ templateID: string; buildID: string }>(
+ 'https://api.e2b.app/templates/:templateID/builds/:buildID/status',
+ ({ params }) => {
+ const { templateID } = params
+ return HttpResponse.json({
+ status: 'error',
+ reason: {
+ message: 'Mocked API build error',
+ step: failureMap[templateID],
+ },
+ logEntries: [],
+ })
+ }
+ ),
+]
+
+const server = setupServer(...restHandlers)
+
+beforeAll(() => server.listen({ onUnhandledRequest: 'error' }))
+
+afterAll(() => server.close())
+
+afterEach(() => server.resetHandlers())
+
function getStackTraceCallerMethod(
fileContent: string,
stackTrace: string | undefined
@@ -65,14 +135,14 @@ async function expectToThrowAndCheckTrace(
buildTemplateTest('traces on fromImage', async ({ buildTemplate }) => {
const template = Template().fromImage('e2b.dev/this-image-does-not-exist')
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template, { skipCache: true })
+ await buildTemplate(template, { alias: 'fromImage', skipCache: true })
}, 'fromImage')
})
buildTemplateTest('traces on fromTemplate', async ({ buildTemplate }) => {
const template = Template().fromTemplate('this-template-does-not-exist')
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template, { skipCache: true })
+ await buildTemplate(template, { alias: 'fromTemplate', skipCache: true })
}, 'fromTemplate')
})
@@ -81,7 +151,7 @@ buildTemplateTest('traces on fromDockerfile', async ({ buildTemplate }) => {
'FROM ubuntu:22.04\nRUN nonexistent'
)
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template, { skipCache: true })
+ await buildTemplate(template, { alias: 'fromDockerfile', skipCache: true })
}, 'fromDockerfile')
})
@@ -94,7 +164,9 @@ buildTemplateTest('traces on fromImage registry', async ({ buildTemplate }) => {
}
)
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template, { skipCache: true })
+ await buildTemplate(template, {
+ alias: 'fromImageRegistry',
+ })
}, 'fromImage')
})
@@ -108,7 +180,7 @@ buildTemplateTest('traces on fromAWSRegistry', async ({ buildTemplate }) => {
}
)
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template, { skipCache: true })
+ await buildTemplate(template, { alias: 'fromAWSRegistry' })
}, 'fromAWSRegistry')
})
@@ -120,7 +192,7 @@ buildTemplateTest('traces on fromGCPRegistry', async ({ buildTemplate }) => {
}
)
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template, { skipCache: true })
+ await buildTemplate(template, { alias: 'fromGCPRegistry' })
}, 'fromGCPRegistry')
})
@@ -128,7 +200,7 @@ buildTemplateTest('traces on copy', async ({ buildTemplate }) => {
let template = Template().fromBaseImage()
template = template.skipCache().copy(nonExistentPath, nonExistentPath)
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template)
+ await buildTemplate(template, { alias: 'copy' })
}, 'copy')
})
@@ -138,7 +210,7 @@ buildTemplateTest('traces on copyItems', async ({ buildTemplate }) => {
.skipCache()
.copyItems([{ src: nonExistentPath, dest: nonExistentPath }])
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template)
+ await buildTemplate(template, { alias: 'copyItems' })
}, 'copyItems')
})
@@ -146,7 +218,7 @@ buildTemplateTest('traces on remove', async ({ buildTemplate }) => {
let template = Template().fromBaseImage()
template = template.skipCache().remove(nonExistentPath)
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template)
+ await buildTemplate(template, { alias: 'remove' })
}, 'remove')
})
@@ -154,7 +226,7 @@ buildTemplateTest('traces on rename', async ({ buildTemplate }) => {
let template = Template().fromBaseImage()
template = template.skipCache().rename(nonExistentPath, '/tmp/dest.txt')
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template)
+ await buildTemplate(template, { alias: 'rename' })
}, 'rename')
})
@@ -162,7 +234,7 @@ buildTemplateTest('traces on makeDir', async ({ buildTemplate }) => {
let template = Template().fromBaseImage()
template = template.skipCache().makeDir('.bashrc')
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template)
+ await buildTemplate(template, { alias: 'makeDir' })
}, 'makeDir')
})
@@ -170,7 +242,7 @@ buildTemplateTest('traces on makeSymlink', async ({ buildTemplate }) => {
let template = Template().fromBaseImage()
template = template.skipCache().makeSymlink('.bashrc', '.bashrc')
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template)
+ await buildTemplate(template, { alias: 'makeSymlink' })
}, 'makeSymlink')
})
@@ -178,18 +250,15 @@ buildTemplateTest('traces on runCmd', async ({ buildTemplate }) => {
let template = Template().fromBaseImage()
template = template.skipCache().runCmd(`./${nonExistentPath}`)
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template)
+ await buildTemplate(template, { alias: 'runCmd' })
}, 'runCmd')
})
buildTemplateTest('traces on setWorkdir', async ({ buildTemplate }) => {
- const template = Template()
- .fromBaseImage()
- .setUser('root')
- .skipCache()
- .setWorkdir('/root/.bashrc')
+ let template = Template().fromBaseImage()
+ template = template.skipCache().setWorkdir('/root/.bashrc')
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template)
+ await buildTemplate(template, { alias: 'setWorkdir' })
}, 'setWorkdir')
})
@@ -197,7 +266,7 @@ buildTemplateTest('traces on setUser', async ({ buildTemplate }) => {
let template = Template().fromBaseImage()
template = template.skipCache().setUser('; exit 1')
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template)
+ await buildTemplate(template, { alias: 'setUser' })
}, 'setUser')
})
@@ -205,7 +274,7 @@ buildTemplateTest('traces on pipInstall', async ({ buildTemplate }) => {
let template = Template().fromBaseImage()
template = template.skipCache().pipInstall('nonexistent-package')
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template)
+ await buildTemplate(template, { alias: 'pipInstall' })
}, 'pipInstall')
})
@@ -213,7 +282,7 @@ buildTemplateTest('traces on npmInstall', async ({ buildTemplate }) => {
let template = Template().fromBaseImage()
template = template.skipCache().npmInstall('nonexistent-package')
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template)
+ await buildTemplate(template, { alias: 'npmInstall' })
}, 'npmInstall')
})
@@ -221,7 +290,7 @@ buildTemplateTest('traces on aptInstall', async ({ buildTemplate }) => {
let template = Template().fromBaseImage()
template = template.skipCache().aptInstall('nonexistent-package')
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template)
+ await buildTemplate(template, { alias: 'aptInstall' })
}, 'aptInstall')
})
@@ -231,7 +300,7 @@ buildTemplateTest('traces on gitClone', async ({ buildTemplate }) => {
.skipCache()
.gitClone('https://github.com/nonexistent/repo.git')
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template)
+ await buildTemplate(template, { alias: 'gitClone' })
}, 'gitClone')
})
@@ -242,7 +311,7 @@ buildTemplateTest('traces on setStartCmd', async ({ buildTemplate }) => {
waitForTimeout(10_000)
)
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template)
+ await buildTemplate(template, { alias: 'setStartCmd' })
}, 'setStartCmd')
})
@@ -261,7 +330,9 @@ buildTemplateTest(
.skipCache()
.betaDevContainerPrebuild(nonExistentPath)
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template)
+ await buildTemplate(template, {
+ alias: 'betaDevContainerPrebuild',
+ })
}, 'betaDevContainerPrebuild')
}
)
@@ -273,7 +344,9 @@ buildTemplateTest(
.fromTemplate('devcontainer')
.betaSetDevContainerStart(nonExistentPath)
await expectToThrowAndCheckTrace(async () => {
- await buildTemplate(template)
+ await buildTemplate(template, {
+ alias: 'betaSetDevContainerStart',
+ })
}, 'betaSetDevContainerStart')
}
)
diff --git a/packages/python-sdk/tests/async/template_async/methods/test_apt_install.py b/packages/python-sdk/tests/async/template_async/methods/test_apt_install.py
index 4125b8a48..5ed639207 100644
--- a/packages/python-sdk/tests/async/template_async/methods/test_apt_install.py
+++ b/packages/python-sdk/tests/async/template_async/methods/test_apt_install.py
@@ -6,7 +6,7 @@ from e2b import AsyncTemplate
@pytest.mark.skip_debug()
async def test_apt_install(async_build):
template = (
- AsyncTemplate().from_image("ubuntu:24.04").skip_cache().apt_install(["vim"])
+ AsyncTemplate().from_image("ubuntu:24.04").skip_cache().apt_install("rolldice")
)
await async_build(template)
@@ -18,6 +18,6 @@ async def test_apt_install_no_install_recommends(async_build):
AsyncTemplate()
.from_image("ubuntu:24.04")
.skip_cache()
- .apt_install(["vim"], no_install_recommends=True)
+ .apt_install("rolldice", no_install_recommends=True)
)
await async_build(template)
diff --git a/packages/python-sdk/tests/async/template_async/methods/test_bun_install.py b/packages/python-sdk/tests/async/template_async/methods/test_bun_install.py
index 232a70e3c..7dafa79e4 100644
--- a/packages/python-sdk/tests/async/template_async/methods/test_bun_install.py
+++ b/packages/python-sdk/tests/async/template_async/methods/test_bun_install.py
@@ -6,10 +6,7 @@ from e2b import AsyncTemplate
@pytest.mark.skip_debug()
async def test_bun_install(async_build):
template = (
- AsyncTemplate()
- .from_bun_image("1.3")
- .skip_cache()
- .bun_install(["lodash", "axios"])
+ AsyncTemplate().from_bun_image("1.3").skip_cache().bun_install("left-pad")
)
await async_build(template)
@@ -18,7 +15,10 @@ async def test_bun_install(async_build):
@pytest.mark.skip_debug()
async def test_bun_install_global(async_build):
template = (
- AsyncTemplate().from_bun_image("1.3").skip_cache().bun_install(["tsx"], g=True)
+ AsyncTemplate()
+ .from_bun_image("1.3")
+ .skip_cache()
+ .bun_install("left-pad", g=True)
)
await async_build(template)
@@ -30,7 +30,7 @@ async def test_bun_install_dev(async_build):
AsyncTemplate()
.from_bun_image("1.3")
.skip_cache()
- .bun_install(["typescript"], dev=True)
+ .bun_install("left-pad", dev=True)
)
await async_build(template)
diff --git a/packages/python-sdk/tests/async/template_async/methods/test_from_dockerfile.py b/packages/python-sdk/tests/async/template_async/methods/test_from_dockerfile.py
new file mode 100644
index 000000000..d37e036cb
--- /dev/null
+++ b/packages/python-sdk/tests/async/template_async/methods/test_from_dockerfile.py
@@ -0,0 +1,62 @@
+import pytest
+
+from e2b import AsyncTemplate
+from e2b.template.types import InstructionType
+
+
+async def test_from_dockerfile():
+ dockerfile = """FROM node:24
+WORKDIR /app
+COPY package.json .
+RUN npm install"""
+
+ template = AsyncTemplate().from_dockerfile(dockerfile)
+
+ # base image
+ assert template._template._base_image == "node:24"
+
+ instructions = template._template._instructions
+
+ # Docker defaults
+ assert instructions[1]["type"] == InstructionType.WORKDIR
+ assert instructions[1]["args"][0] == "/"
+
+ # Instructions from Dockerfile
+ assert instructions[2]["type"] == InstructionType.WORKDIR
+ assert instructions[2]["args"][0] == "/app"
+
+ assert instructions[3]["type"] == InstructionType.COPY
+ assert instructions[3]["args"][0] == "package.json"
+ assert instructions[3]["args"][1] == "."
+
+ assert instructions[4]["type"] == InstructionType.RUN
+ assert instructions[4]["args"][0] == "npm install"
+
+ # E2B defaults appended
+ assert instructions[5]["type"] == InstructionType.USER
+ assert instructions[5]["args"][0] == "user"
+
+
+async def test_from_dockerfile_with_default_user_and_workdir():
+ dockerfile = "FROM node:24"
+
+ template = AsyncTemplate().from_dockerfile(dockerfile)
+
+ assert template._template._instructions[-2]["type"] == InstructionType.USER
+ assert template._template._instructions[-2]["args"][0] == "user"
+ assert template._template._instructions[-1]["type"] == InstructionType.WORKDIR
+ assert template._template._instructions[-1]["args"][0] == "/home/user"
+
+
+async def test_from_dockerfile_with_custom_user_and_workdir():
+ dockerfile = "FROM node:24\nUSER mish\nWORKDIR /home/mish"
+
+ template = AsyncTemplate().from_dockerfile(dockerfile)
+
+ assert template._template._instructions[-2]["type"] == InstructionType.USER
+ assert template._template._instructions[-2]["args"][0] == "mish"
+ assert template._template._instructions[-1]["type"] == InstructionType.WORKDIR
+ assert template._template._instructions[-1]["args"][0] == "/home/mish"
diff --git a/packages/python-sdk/tests/async/template_async/methods/test_from_methods.py b/packages/python-sdk/tests/async/template_async/methods/test_from_methods.py
deleted file mode 100644
index 90b8d077a..000000000
--- a/packages/python-sdk/tests/async/template_async/methods/test_from_methods.py
+++ /dev/null
@@ -1,142 +0,0 @@
-import tempfile
-import os
-import shutil
-import json
-
-import pytest
-
-from e2b import AsyncTemplate
-from e2b.template.types import InstructionType
-
-
[email protected](scope="module")
-def setup_dockerfile_context():
- """Setup test directory with package.json for dockerfile context tests"""
- test_dir = tempfile.mkdtemp(prefix="python_async_dockerfile_test_")
-
- with open(os.path.join(test_dir, "package.json"), "w") as f:
- json.dump({"name": "my-app", "version": "1.0.0"}, f, indent=2)
-
- yield test_dir
-
- # Cleanup
- shutil.rmtree(test_dir, ignore_errors=True)
-
-
-async def test_from_base_image(async_build):
- template = AsyncTemplate().from_base_image()
- await async_build(template, skip_cache=True)
-
-
-async def test_from_debian_image(async_build):
- template = AsyncTemplate().from_debian_image()
- await async_build(template, skip_cache=True)
-
-
-async def test_from_debian_image_with_variant(async_build):
- template = AsyncTemplate().from_debian_image("bookworm")
- await async_build(template, skip_cache=True)
-
-
-async def test_from_ubuntu_image(async_build):
- template = AsyncTemplate().from_ubuntu_image()
- await async_build(template, skip_cache=True)
-
-
-async def test_from_ubuntu_image_with_variant(async_build):
- template = AsyncTemplate().from_ubuntu_image("24.04")
- await async_build(template, skip_cache=True)
-
-
-async def test_from_python_image(async_build):
- template = AsyncTemplate().from_python_image()
- await async_build(template, skip_cache=True)
-
-
-async def test_from_python_image_with_variant(async_build):
- template = AsyncTemplate().from_python_image("3.12")
- await async_build(template, skip_cache=True)
-
-
-async def test_from_node_image(async_build):
- template = AsyncTemplate().from_node_image()
- await async_build(template, skip_cache=True)
-
-
-async def test_from_bun_image(async_build):
- template = AsyncTemplate().from_bun_image()
- await async_build(template, skip_cache=True)
-
-
-async def test_from_bun_image_with_variant(async_build):
- template = AsyncTemplate().from_bun_image("1.3")
- await async_build(template, skip_cache=True)
-
-
-async def test_from_node_image_with_variant(async_build):
- template = AsyncTemplate().from_node_image("24")
- await async_build(template, skip_cache=True)
-
-
-async def test_from_image(async_build):
- template = AsyncTemplate().from_image("ubuntu:22.04")
- await async_build(template, skip_cache=True)
-
-
-async def test_from_template(async_build):
- template = AsyncTemplate().from_template("base")
- await async_build(template, skip_cache=True)
-
-
-async def test_from_dockerfile(async_build, setup_dockerfile_context):
- dockerfile = """FROM node:24
-WORKDIR /app
-COPY package.json .
-RUN npm install"""
-
- template = AsyncTemplate(
- file_context_path=setup_dockerfile_context
- ).from_dockerfile(dockerfile)
- await async_build(template, skip_cache=True)
-
-
-async def test_from_dockerfile_with_default_user_and_workdir(setup_dockerfile_context):
- dockerfile = "FROM node:24"
-
- template = AsyncTemplate(
- file_context_path=setup_dockerfile_context
- ).from_dockerfile(dockerfile)
-
- assert template._template._instructions[-2]["type"] == InstructionType.USER
- assert template._template._instructions[-2]["args"][0] == "user"
- assert template._template._instructions[-1]["type"] == InstructionType.WORKDIR
- assert template._template._instructions[-1]["args"][0] == "/home/user"
-
-
-async def test_from_dockerfile_with_custom_user_and_workdir(setup_dockerfile_context):
- dockerfile = "FROM node:24\nUSER mish\nWORKDIR /home/mish"
-
- template = AsyncTemplate(
- file_context_path=setup_dockerfile_context
- ).from_dockerfile(dockerfile)
-
- assert template._template._instructions[-2]["type"] == InstructionType.USER
- assert template._template._instructions[-2]["args"][0] == "mish"
- assert template._template._instructions[-1]["type"] == InstructionType.WORKDIR
- assert template._template._instructions[-1]["args"][0] == "/home/mish"
diff --git a/packages/python-sdk/tests/async/template_async/methods/test_make_symlink.py b/packages/python-sdk/tests/async/template_async/methods/test_make_symlink.py
index aee4a453a..f6c1c6113 100644
--- a/packages/python-sdk/tests/async/template_async/methods/test_make_symlink.py
+++ b/packages/python-sdk/tests/async/template_async/methods/test_make_symlink.py
@@ -21,8 +21,8 @@ async def test_make_symlink_force(async_build):
template = (
AsyncTemplate()
.from_image("ubuntu:22.04")
- .skip_cache()
.make_symlink(".bashrc", ".bashrc.local")
+ .skip_cache()
.make_symlink(
".bashrc", ".bashrc.local", force=True
) # Overwrite existing symlink
diff --git a/packages/python-sdk/tests/async/template_async/methods/test_npm_install.py b/packages/python-sdk/tests/async/template_async/methods/test_npm_install.py
index bac27cfc9..c61cc7f58 100644
--- a/packages/python-sdk/tests/async/template_async/methods/test_npm_install.py
+++ b/packages/python-sdk/tests/async/template_async/methods/test_npm_install.py
@@ -6,10 +6,7 @@ from e2b import AsyncTemplate
@pytest.mark.skip_debug()
async def test_npm_install(async_build):
template = (
- AsyncTemplate()
- .from_node_image("24")
- .skip_cache()
- .npm_install(["lodash", "axios"])
+ AsyncTemplate().from_node_image("24").skip_cache().npm_install("left-pad")
)
await async_build(template)
@@ -18,7 +15,10 @@ async def test_npm_install(async_build):
@pytest.mark.skip_debug()
async def test_npm_install_global(async_build):
template = (
- AsyncTemplate().from_node_image("24").skip_cache().npm_install(["tsx"], g=True)
+ AsyncTemplate()
+ .from_node_image("24")
+ .skip_cache()
+ .npm_install("left-pad", g=True)
)
await async_build(template)
@@ -30,7 +30,7 @@ async def test_npm_install_dev(async_build):
AsyncTemplate()
.from_node_image("24")
.skip_cache()
- .npm_install(["typescript"], dev=True)
+ .npm_install("left-pad", dev=True)
)
await async_build(template)
diff --git a/packages/python-sdk/tests/async/template_async/methods/test_pip_install.py b/packages/python-sdk/tests/async/template_async/methods/test_pip_install.py
index dc047ecc7..d53acf63b 100644
--- a/packages/python-sdk/tests/async/template_async/methods/test_pip_install.py
+++ b/packages/python-sdk/tests/async/template_async/methods/test_pip_install.py
@@ -9,7 +9,7 @@ async def test_pip_install(async_build):
AsyncTemplate()
.from_python_image("3.13.7-trixie")
.skip_cache()
- .pip_install(["six", "pyyaml"])
+ .pip_install("pip-install-test")
)
await async_build(template)
@@ -21,7 +21,7 @@ async def test_pip_install_user(async_build):
AsyncTemplate()
.from_python_image("3.13.7-trixie")
.skip_cache()
- .pip_install(["six", "pyyaml"], g=False)
+ .pip_install("pip-install-test", g=False)
)
await async_build(template)
diff --git a/packages/python-sdk/tests/async/template_async/test_build.py b/packages/python-sdk/tests/async/template_async/test_build.py
index 5aba74d40..f16da0bd4 100644
--- a/packages/python-sdk/tests/async/template_async/test_build.py
+++ b/packages/python-sdk/tests/async/template_async/test_build.py
@@ -44,7 +44,7 @@ def setup_test_folder():
async def test_build_template(async_build, setup_test_folder):
template = (
AsyncTemplate(file_context_path=setup_test_folder)
- .from_image("ubuntu:22.04")
+ .from_base_image()
.copy("folder/*", "folder", force_upload=True)
.run_cmd("cat folder/test.txt")
.set_workdir("/app")
@@ -54,6 +54,12 @@ async def test_build_template(async_build, setup_test_folder):
await async_build(template, skip_cache=True, on_build_logs=default_build_logger())
+async def test_build_template_from_base_template(async_build):
+ template = AsyncTemplate().from_template("base")
+ await async_build(template, skip_cache=True, on_build_logs=default_build_logger())
+
+
@pytest.mark.skip_debug()
async def test_build_template_with_symlinks(async_build, setup_test_folder):
template = (
diff --git a/packages/python-sdk/tests/async/template_async/test_stacktrace.py b/packages/python-sdk/tests/async/template_async/test_stacktrace.py
index ba5813594..7bff6ee22 100644
--- a/packages/python-sdk/tests/async/template_async/test_stacktrace.py
+++ b/packages/python-sdk/tests/async/template_async/test_stacktrace.py
@@ -1,10 +1,73 @@
+import traceback
+from types import SimpleNamespace
+from typing import Optional
+from uuid import uuid4
+
import pytest
import linecache
from e2b import AsyncTemplate, CopyItem, wait_for_timeout
+from e2b.api.client.models import TemplateBuildStatus
+import e2b.template_async.main as template_async_main
+import e2b.template_async.build_api as build_api_mod
non_existent_path = "/nonexistent/path"
+# map template alias -> failed step index
+failure_map: dict[str, Optional[int]] = {
+ "from_image": 0,
+ "from_template": 0,
+ "from_dockerfile": 0,
+ "from_image_registry": 0,
+ "from_aws_registry": 0,
+ "from_gcp_registry": 0,
+ "copy": None,
+ "copy_items": None,
+ "remove": 1,
+ "rename": 1,
+ "make_dir": 1,
+ "make_symlink": 1,
+ "run_cmd": 1,
+ "set_workdir": 1,
+ "set_user": 1,
+ "pip_install": 1,
+ "npm_install": 1,
+ "apt_install": 1,
+ "git_clone": 1,
+ "set_start_cmd": 1,
+ "add_mcp_server": None,
+ "beta_dev_container_prebuild": 1,
+ "beta_set_dev_container_start": 1,
+}
+
+
[email protected](autouse=True)
+def mock_template_build(monkeypatch):
+ async def mock_request_build(client, name: str, cpu_count: int, memory_mb: int):
+ return SimpleNamespace(template_id=name, build_id=str(uuid4()))
+
+ async def mock_trigger_build(client, template_id: str, build_id: str, template):
+ return None
+
+ async def mock_get_build_status(
+ client, template_id: str, build_id: str, logs_offset: int
+ ):
+ step = failure_map[template_id]
+ reason = SimpleNamespace(
+ message="Mocked API build error",
+ log_entries=[],
+ step=str(step) if step is not None else None,
+ )
+ return SimpleNamespace(
+ status=TemplateBuildStatus.ERROR,
+ log_entries=[],
+ reason=reason,
+ )
+
+ monkeypatch.setattr(template_async_main, "request_build", mock_request_build)
+ monkeypatch.setattr(template_async_main, "trigger_build", mock_trigger_build)
+ monkeypatch.setattr(build_api_mod, "get_build_status", mock_get_build_status)
+
async def _expect_to_throw_and_check_trace(func, expected_method: str):
try:
@@ -23,15 +86,15 @@ async def _expect_to_throw_and_check_trace(func, expected_method: str):
saw_expected_method = True
break
tb = tb.tb_next
- assert saw_this_file
- assert saw_expected_method
+ assert saw_this_file, traceback.format_exc()
+ assert saw_expected_method, traceback.format_exc()
@pytest.mark.skip_debug()
async def test_traces_on_from_image(async_build):
template = AsyncTemplate().from_image("e2b.dev/this-image-does-not-exist")
await _expect_to_throw_and_check_trace(
- lambda: async_build(template, skip_cache=True), "from_image"
+ lambda: async_build(template, alias="from_image", skip_cache=True), "from_image"
)
@@ -39,7 +102,8 @@ async def test_traces_on_from_image(async_build):
async def test_traces_on_from_template(async_build):
template = AsyncTemplate().from_template("this-template-does-not-exist")
await _expect_to_throw_and_check_trace(
- lambda: async_build(template, skip_cache=True), "from_template"
+ lambda: async_build(template, alias="from_template", skip_cache=True),
+ "from_template",
)
@@ -47,7 +111,8 @@ async def test_traces_on_from_template(async_build):
async def test_traces_on_from_dockerfile(async_build):
template = AsyncTemplate().from_dockerfile("FROM ubuntu:22.04\nRUN nonexistent")
await _expect_to_throw_and_check_trace(
- lambda: async_build(template, skip_cache=True), "from_dockerfile"
+ lambda: async_build(template, alias="from_dockerfile", skip_cache=True),
+ "from_dockerfile",
)
@@ -59,7 +124,8 @@ async def test_traces_on_from_image_registry(async_build):
password="test",
)
await _expect_to_throw_and_check_trace(
- lambda: async_build(template, skip_cache=True), "from_image"
+ lambda: async_build(template, alias="from_image_registry", skip_cache=True),
+ "from_image",
)
@@ -72,7 +138,7 @@ async def test_traces_on_from_aws_registry(async_build):
region="us-east-1",
)
await _expect_to_throw_and_check_trace(
- lambda: async_build(template, skip_cache=True), "from_aws_registry"
+ lambda: async_build(template, alias="from_aws_registry"), "from_aws_registry"
)
@@ -85,7 +151,7 @@ async def test_traces_on_from_gcp_registry(async_build):
},
)
await _expect_to_throw_and_check_trace(
- lambda: async_build(template, skip_cache=True), "from_gcp_registry"
+ lambda: async_build(template, alias="from_gcp_registry"), "from_gcp_registry"
)
@@ -94,7 +160,9 @@ async def test_traces_on_copy(async_build):
template = AsyncTemplate()
template = template.from_base_image()
template = template.skip_cache().copy(non_existent_path, non_existent_path)
- await _expect_to_throw_and_check_trace(lambda: async_build(template), "copy")
+ await _expect_to_throw_and_check_trace(
+ lambda: async_build(template, alias="copy"), "copy"
+ )
@pytest.mark.skip_debug()
@@ -104,7 +172,9 @@ async def test_traces_on_copyItems(async_build):
template = template.skip_cache().copy_items(
[CopyItem(src=non_existent_path, dest=non_existent_path)]
)
- await _expect_to_throw_and_check_trace(lambda: async_build(template), "copy_items")
+ await _expect_to_throw_and_check_trace(
+ lambda: async_build(template, alias="copy_items"), "copy_items"
+ )
@pytest.mark.skip_debug()
@@ -112,7 +182,9 @@ async def test_traces_on_remove(async_build):
template = AsyncTemplate()
template = template.from_base_image()
template = template.skip_cache().remove(non_existent_path)
- await _expect_to_throw_and_check_trace(lambda: async_build(template), "remove")
+ await _expect_to_throw_and_check_trace(
+ lambda: async_build(template, alias="remove"), "remove"
+ )
@pytest.mark.skip_debug()
@@ -120,7 +192,9 @@ async def test_traces_on_rename(async_build):
template = AsyncTemplate()
template = template.from_base_image()
template = template.skip_cache().rename(non_existent_path, "/tmp/dest.txt")
- await _expect_to_throw_and_check_trace(lambda: async_build(template), "rename")
+ await _expect_to_throw_and_check_trace(
+ lambda: async_build(template, alias="rename"), "rename"
+ )
@pytest.mark.skip_debug()
@@ -128,7 +202,9 @@ async def test_traces_on_make_dir(async_build):
template = AsyncTemplate()
template = template.from_base_image()
template = template.set_user("root").skip_cache().make_dir("/root/.bashrc")
- await _expect_to_throw_and_check_trace(lambda: async_build(template), "make_dir")
+ await _expect_to_throw_and_check_trace(
+ lambda: async_build(template, alias="make_dir"), "make_dir"
+ )
@pytest.mark.skip_debug()
@@ -137,7 +213,7 @@ async def test_traces_on_make_symlink(async_build):
template = template.from_base_image()
template = template.skip_cache().make_symlink(".bashrc", ".bashrc")
await _expect_to_throw_and_check_trace(
- lambda: async_build(template), "make_symlink"
+ lambda: async_build(template, alias="make_symlink"), "make_symlink"
)
@@ -146,7 +222,9 @@ async def test_traces_on_run_cmd(async_build):
template = AsyncTemplate()
template = template.from_base_image()
template = template.skip_cache().run_cmd(f"cat {non_existent_path}")
- await _expect_to_throw_and_check_trace(lambda: async_build(template), "run_cmd")
+ await _expect_to_throw_and_check_trace(
+ lambda: async_build(template, alias="run_cmd"), "run_cmd"
+ )
@pytest.mark.skip_debug()
@@ -154,7 +232,9 @@ async def test_traces_on_set_workdir(async_build):
template = AsyncTemplate()
template = template.from_base_image()
template = template.set_user("root").skip_cache().set_workdir("/root/.bashrc")
- await _expect_to_throw_and_check_trace(lambda: async_build(template), "set_workdir")
+ await _expect_to_throw_and_check_trace(
+ lambda: async_build(template, alias="set_workdir"), "set_workdir"
+ )
@pytest.mark.skip_debug()
@@ -162,7 +242,9 @@ async def test_traces_on_set_user(async_build):
template = AsyncTemplate()
template = template.from_base_image()
template = template.skip_cache().set_user("; exit 1")
- await _expect_to_throw_and_check_trace(lambda: async_build(template), "set_user")
+ await _expect_to_throw_and_check_trace(
+ lambda: async_build(template, alias="set_user"), "set_user"
+ )
@pytest.mark.skip_debug()
@@ -170,7 +252,9 @@ async def test_traces_on_pip_install(async_build):
template = AsyncTemplate()
template = template.from_base_image()
template = template.skip_cache().pip_install("nonexistent-package")
- await _expect_to_throw_and_check_trace(lambda: async_build(template), "pip_install")
+ await _expect_to_throw_and_check_trace(
+ lambda: async_build(template, alias="pip_install"), "pip_install"
+ )
@pytest.mark.skip_debug()
@@ -178,7 +262,9 @@ async def test_traces_on_npm_install(async_build):
template = AsyncTemplate()
template = template.from_base_image()
template = template.skip_cache().npm_install("nonexistent-package")
- await _expect_to_throw_and_check_trace(lambda: async_build(template), "npm_install")
+ await _expect_to_throw_and_check_trace(
+ lambda: async_build(template, alias="npm_install"), "npm_install"
+ )
@pytest.mark.skip_debug()
@@ -186,7 +272,9 @@ async def test_traces_on_apt_install(async_build):
template = AsyncTemplate()
template = template.from_base_image()
template = template.skip_cache().apt_install("nonexistent-package")
- await _expect_to_throw_and_check_trace(lambda: async_build(template), "apt_install")
+ await _expect_to_throw_and_check_trace(
+ lambda: async_build(template, alias="apt_install"), "apt_install"
+ )
@pytest.mark.skip_debug()
@@ -194,7 +282,9 @@ async def test_traces_on_git_clone(async_build):
template = AsyncTemplate()
template = template.from_base_image()
template = template.skip_cache().git_clone("https://github.com/repo.git")
- await _expect_to_throw_and_check_trace(lambda: async_build(template), "git_clone")
+ await _expect_to_throw_and_check_trace(
+ lambda: async_build(template, alias="git_clone"), "git_clone"
+ )
@pytest.mark.skip_debug()
@@ -205,7 +295,7 @@ async def test_traces_on_start_cmd(async_build):
f"./{non_existent_path}", wait_for_timeout(10_000)
)
await _expect_to_throw_and_check_trace(
- lambda: async_build(template), "set_start_cmd"
+ lambda: async_build(template, alias="set_start_cmd"), "set_start_cmd"
)
@@ -224,7 +314,8 @@ async def test_traces_on_dev_container_prebuild(async_build):
template = template.from_template("devcontainer")
template = template.skip_cache().beta_dev_container_prebuild(non_existent_path)
await _expect_to_throw_and_check_trace(
- lambda: async_build(template), "beta_dev_container_prebuild"
+ lambda: async_build(template, alias="beta_dev_container_prebuild"),
+ "beta_dev_container_prebuild",
)
@@ -234,5 +325,6 @@ async def test_traces_on_set_dev_container_start(async_build):
template = template.from_template("devcontainer")
template = template.beta_set_dev_container_start(non_existent_path)
await _expect_to_throw_and_check_trace(
- lambda: async_build(template), "beta_set_dev_container_start"
+ lambda: async_build(template, alias="beta_set_dev_container_start"),
+ "beta_set_dev_container_start",
)
diff --git a/packages/python-sdk/tests/conftest.py b/packages/python-sdk/tests/conftest.py
index a6be393fa..8ce631196 100644
--- a/packages/python-sdk/tests/conftest.py
+++ b/packages/python-sdk/tests/conftest.py
@@ -97,12 +97,13 @@ async def async_sandbox(async_sandbox_factory):
def build():
def _build(
template: TemplateClass,
+ alias: Optional[str] = None,
skip_cache: bool = False,
on_build_logs: Optional[Callable[[LogEntry], None]] = None,
):
return Template.build(
template,
- alias=f"e2b-test-{uuid4()}",
+ alias=alias or f"e2b-test-{uuid4()}",
cpu_count=1,
memory_mb=1024,
skip_cache=skip_cache,
@@ -116,12 +117,13 @@ def build():
def async_build():
async def _async_build(
template: TemplateClass,
+ alias: Optional[str] = None,
skip_cache: bool = False,
on_build_logs: Optional[Callable[[LogEntry], None]] = None,
):
return await AsyncTemplate.build(
template,
- alias=f"e2b-test-{uuid4()}",
+ alias=alias or f"e2b-test-{uuid4()}",
cpu_count=1,
memory_mb=1024,
skip_cache=skip_cache,
diff --git a/packages/python-sdk/tests/sync/template_sync/methods/test_apt_install.py b/packages/python-sdk/tests/sync/template_sync/methods/test_apt_install.py
index d10dc96e4..a82b93c83 100644
--- a/packages/python-sdk/tests/sync/template_sync/methods/test_apt_install.py
+++ b/packages/python-sdk/tests/sync/template_sync/methods/test_apt_install.py
@@ -5,7 +5,9 @@ from e2b import Template
@pytest.mark.skip_debug()
def test_apt_install(build):
- template = Template().from_image("ubuntu:24.04").skip_cache().apt_install(["vim"])
+ template = (
+ Template().from_image("ubuntu:24.04").skip_cache().apt_install("rolldice")
+ )
build(template)
@@ -16,7 +18,7 @@ def test_apt_install_no_install_recommends(build):
Template()
.from_image("ubuntu:24.04")
.skip_cache()
- .apt_install(["vim"], no_install_recommends=True)
+ .apt_install("rolldice", no_install_recommends=True)
)
build(template)
diff --git a/packages/python-sdk/tests/sync/template_sync/methods/test_bun_install.py b/packages/python-sdk/tests/sync/template_sync/methods/test_bun_install.py
index 4e2a50e83..398477aa6 100644
--- a/packages/python-sdk/tests/sync/template_sync/methods/test_bun_install.py
+++ b/packages/python-sdk/tests/sync/template_sync/methods/test_bun_install.py
@@ -5,9 +5,7 @@ from e2b import Template
@pytest.mark.skip_debug()
def test_bun_install(build):
- template = (
- Template().from_bun_image("1.3").skip_cache().bun_install(["lodash", "axios"])
- )
+ template = Template().from_bun_image("1.3").skip_cache().bun_install("left-pad")
build(template)
@@ -15,7 +13,7 @@ def test_bun_install(build):
@pytest.mark.skip_debug()
def test_bun_install_global(build):
template = (
- Template().from_bun_image("1.3").skip_cache().bun_install(["tsx"], g=True)
+ Template().from_bun_image("1.3").skip_cache().bun_install("left-pad", g=True)
)
build(template)
@@ -24,10 +22,7 @@ def test_bun_install_global(build):
@pytest.mark.skip_debug()
def test_bun_install_dev(build):
template = (
- Template()
- .from_bun_image("1.3")
- .skip_cache()
- .bun_install(["typescript"], dev=True)
+ Template().from_bun_image("1.3").skip_cache().bun_install("left-pad", dev=True)
)
build(template)
diff --git a/packages/python-sdk/tests/sync/template_sync/methods/test_from_dockerfile.py b/packages/python-sdk/tests/sync/template_sync/methods/test_from_dockerfile.py
new file mode 100644
index 000000000..8e636b5fa
--- /dev/null
+++ b/packages/python-sdk/tests/sync/template_sync/methods/test_from_dockerfile.py
@@ -0,0 +1,62 @@
+import pytest
+
+from e2b import Template
+from e2b.template.types import InstructionType
+
+
+def test_from_dockerfile():
+ dockerfile = """FROM node:24
+WORKDIR /app
+COPY package.json .
+RUN npm install"""
+
+ template = Template().from_dockerfile(dockerfile)
+
+ # base image
+ assert template._template._base_image == "node:24"
+
+ instructions = template._template._instructions
+
+ # Docker defaults
+ assert instructions[1]["type"] == InstructionType.WORKDIR
+ assert instructions[1]["args"][0] == "/"
+
+ # Instructions from Dockerfile
+ assert instructions[2]["type"] == InstructionType.WORKDIR
+ assert instructions[2]["args"][0] == "/app"
+
+ assert instructions[3]["type"] == InstructionType.COPY
+ assert instructions[3]["args"][0] == "package.json"
+ assert instructions[3]["args"][1] == "."
+
+ assert instructions[4]["type"] == InstructionType.RUN
+ assert instructions[4]["args"][0] == "npm install"
+
+ # E2B defaults appended
+ assert instructions[5]["type"] == InstructionType.USER
+ assert instructions[5]["args"][0] == "user"
+
+
+def test_from_dockerfile_with_default_user_and_workdir():
+ dockerfile = "FROM node:24"
+
+ template = Template().from_dockerfile(dockerfile)
+
+ assert template._template._instructions[-2]["type"] == InstructionType.USER
+ assert template._template._instructions[-2]["args"][0] == "user"
+ assert template._template._instructions[-1]["type"] == InstructionType.WORKDIR
+ assert template._template._instructions[-1]["args"][0] == "/home/user"
+
+
+def test_from_dockerfile_with_custom_user_and_workdir():
+ dockerfile = "FROM node:24\nUSER mish\nWORKDIR /home/mish"
+
+ template = Template().from_dockerfile(dockerfile)
+
+ assert template._template._instructions[-2]["type"] == InstructionType.USER
+ assert template._template._instructions[-2]["args"][0] == "mish"
+ assert template._template._instructions[-1]["type"] == InstructionType.WORKDIR
+ assert template._template._instructions[-1]["args"][0] == "/home/mish"
diff --git a/packages/python-sdk/tests/sync/template_sync/methods/test_from_methods.py b/packages/python-sdk/tests/sync/template_sync/methods/test_from_methods.py
deleted file mode 100644
index 2a03b98fe..000000000
--- a/packages/python-sdk/tests/sync/template_sync/methods/test_from_methods.py
+++ /dev/null
@@ -1,143 +0,0 @@
-import tempfile
-import os
-import shutil
-import json
-
-import pytest
-
-from e2b import Template
-from e2b.template.types import InstructionType
-
-
[email protected](scope="module")
-def setup_dockerfile_context():
- """Setup test directory with package.json for dockerfile context tests"""
- test_dir = tempfile.mkdtemp(prefix="python_sync_dockerfile_test_")
-
- os.makedirs(test_dir, exist_ok=True)
- with open(os.path.join(test_dir, "package.json"), "w") as f:
- json.dump({"name": "my-app", "version": "1.0.0"}, f, indent=2)
-
- yield test_dir
-
- # Cleanup
- shutil.rmtree(test_dir, ignore_errors=True)
-
-
-def test_from_base_image(build):
- template = Template().from_base_image()
- build(template, skip_cache=True)
-
-
-def test_from_debian_image(build):
- template = Template().from_debian_image()
- build(template, skip_cache=True)
-
-
-def test_from_debian_image_with_variant(build):
- template = Template().from_debian_image("bookworm")
- build(template, skip_cache=True)
-
-
-def test_from_ubuntu_image(build):
- template = Template().from_ubuntu_image()
- build(template, skip_cache=True)
-
-
-def test_from_ubuntu_image_with_variant(build):
- template = Template().from_ubuntu_image("24.04")
- build(template, skip_cache=True)
-
-
-def test_from_python_image(build):
- template = Template().from_python_image()
- build(template, skip_cache=True)
-
-
-def test_from_python_image_with_variant(build):
- template = Template().from_python_image("3.12")
- build(template, skip_cache=True)
-
-
-def test_from_node_image(build):
- template = Template().from_node_image()
- build(template, skip_cache=True)
-
-
-def test_from_node_image_with_variant(build):
- template = Template().from_node_image("24")
- build(template, skip_cache=True)
-
-
-def test_from_bun_image(build):
- template = Template().from_bun_image()
- build(template, skip_cache=True)
-
-
-def test_from_bun_image_with_variant(build):
- template = Template().from_bun_image("1.3")
- build(template, skip_cache=True)
-
-
-def test_from_image(build):
- template = Template().from_image("ubuntu:22.04")
- build(template, skip_cache=True)
-
-
-def test_from_template(build):
- template = Template().from_template("base")
- build(template, skip_cache=True)
-
-
-def test_from_dockerfile(build, setup_dockerfile_context):
- dockerfile = """FROM node:24
-WORKDIR /app
-COPY package.json .
-RUN npm install"""
-
- template = Template(file_context_path=setup_dockerfile_context).from_dockerfile(
- dockerfile
- )
- build(template, skip_cache=True)
-
-
-def test_from_dockerfile_with_default_user_and_workdir(setup_dockerfile_context):
- dockerfile = "FROM node:24"
-
- template = Template(file_context_path=setup_dockerfile_context).from_dockerfile(
- dockerfile
- )
-
- assert template._template._instructions[-2]["type"] == InstructionType.USER
- assert template._template._instructions[-2]["args"][0] == "user"
- assert template._template._instructions[-1]["type"] == InstructionType.WORKDIR
- assert template._template._instructions[-1]["args"][0] == "/home/user"
-
-
-def test_from_dockerfile_with_custom_user_and_workdir(setup_dockerfile_context):
- dockerfile = "FROM node:24\nUSER mish\nWORKDIR /home/mish"
-
- template = Template(file_context_path=setup_dockerfile_context).from_dockerfile(
- dockerfile
- )
-
- assert template._template._instructions[-2]["type"] == InstructionType.USER
- assert template._template._instructions[-2]["args"][0] == "mish"
- assert template._template._instructions[-1]["type"] == InstructionType.WORKDIR
- assert template._template._instructions[-1]["args"][0] == "/home/mish"
diff --git a/packages/python-sdk/tests/sync/template_sync/methods/test_make_symlink.py b/packages/python-sdk/tests/sync/template_sync/methods/test_make_symlink.py
index 370e1d5a4..037109974 100644
--- a/packages/python-sdk/tests/sync/template_sync/methods/test_make_symlink.py
+++ b/packages/python-sdk/tests/sync/template_sync/methods/test_make_symlink.py
@@ -21,8 +21,8 @@ def test_make_symlink_force(build):
template = (
Template()
.from_image("ubuntu:22.04")
- .skip_cache()
.make_symlink(".bashrc", ".bashrc.local")
+ .skip_cache()
.make_symlink(
".bashrc", ".bashrc.local", force=True
) # Overwrite existing symlink
diff --git a/packages/python-sdk/tests/sync/template_sync/methods/test_npm_install.py b/packages/python-sdk/tests/sync/template_sync/methods/test_npm_install.py
index c77bff7e9..ab6c7d0fa 100644
--- a/packages/python-sdk/tests/sync/template_sync/methods/test_npm_install.py
+++ b/packages/python-sdk/tests/sync/template_sync/methods/test_npm_install.py
@@ -5,9 +5,7 @@ from e2b import Template
@pytest.mark.skip_debug()
def test_npm_install(build):
- template = (
- Template().from_node_image("24").skip_cache().npm_install(["lodash", "axios"])
- )
+ template = Template().from_node_image("24").skip_cache().npm_install("left-pad")
build(template)
@@ -15,7 +13,7 @@ def test_npm_install(build):
@pytest.mark.skip_debug()
def test_npm_install_global(build):
template = (
- Template().from_node_image("24").skip_cache().npm_install(["tsx"], g=True)
+ Template().from_node_image("24").skip_cache().npm_install("left-pad", g=True)
)
build(template)
@@ -24,10 +22,7 @@ def test_npm_install_global(build):
@pytest.mark.skip_debug()
def test_npm_install_dev(build):
template = (
- Template()
- .from_node_image("24")
- .skip_cache()
- .npm_install(["typescript"], dev=True)
+ Template().from_node_image("24").skip_cache().npm_install("left-pad", dev=True)
)
build(template)
diff --git a/packages/python-sdk/tests/sync/template_sync/methods/test_pip_install.py b/packages/python-sdk/tests/sync/template_sync/methods/test_pip_install.py
index 23d5f4382..5d7719dca 100644
--- a/packages/python-sdk/tests/sync/template_sync/methods/test_pip_install.py
+++ b/packages/python-sdk/tests/sync/template_sync/methods/test_pip_install.py
@@ -9,7 +9,7 @@ def test_pip_install(build):
Template()
.from_python_image("3.13.7-trixie")
.skip_cache()
- .pip_install(["six", "pyyaml"])
+ .pip_install("pip-install-test")
)
build(template)
@@ -21,7 +21,7 @@ def test_pip_install_user(build):
Template()
.from_python_image("3.13.7-trixie")
.skip_cache()
- .pip_install(["six", "pyyaml"], g=False)
+ .pip_install("pip-install-test", g=False)
)
build(template)
diff --git a/packages/python-sdk/tests/sync/template_sync/test_build.py b/packages/python-sdk/tests/sync/template_sync/test_build.py
index 085cd5757..423e809c4 100644
--- a/packages/python-sdk/tests/sync/template_sync/test_build.py
+++ b/packages/python-sdk/tests/sync/template_sync/test_build.py
@@ -44,7 +44,8 @@ def setup_test_folder():
def test_build_template(build, setup_test_folder):
template = (
Template(file_context_path=setup_test_folder)
- .from_image("ubuntu:22.04")
+ # using base image to avoid re-building ubuntu:22.04 image
+ .from_base_image()
.copy("folder/*", "folder", force_upload=True)
.run_cmd("cat folder/test.txt")
.set_workdir("/app")
@@ -54,6 +55,12 @@ def test_build_template(build, setup_test_folder):
build(template, skip_cache=True, on_build_logs=default_build_logger())
+def test_build_template_from_base_template(build):
+ template = Template().from_template("base")
+ build(template, skip_cache=True, on_build_logs=default_build_logger())
+
+
@pytest.mark.skip_debug()
def test_build_template_with_symlinks(build, setup_test_folder):
template = (
@@ -83,14 +90,3 @@ def test_build_template_with_resolve_symlinks(build, setup_test_folder):
)
build(template)
-
-
-def test_build_template_with_skip_cache(build, setup_test_folder):
- template = (
- Template(file_context_path=setup_test_folder)
- .skip_cache()
- .from_image("ubuntu:22.04")
- )
-
- build(template)
diff --git a/packages/python-sdk/tests/sync/template_sync/test_stacktrace.py b/packages/python-sdk/tests/sync/template_sync/test_stacktrace.py
index 1fce7ea3b..02e0a97ba 100644
--- a/packages/python-sdk/tests/sync/template_sync/test_stacktrace.py
+++ b/packages/python-sdk/tests/sync/template_sync/test_stacktrace.py
@@ -1,12 +1,73 @@
import traceback
+from types import SimpleNamespace
+from typing import Optional
+from uuid import uuid4
import pytest
import linecache
from e2b import Template, CopyItem, wait_for_timeout
+from e2b.api.client.models import TemplateBuildStatus
+import e2b.template_sync.main as template_sync_main
+import e2b.template_sync.build_api as build_api_mod
non_existent_path = "/nonexistent/path"
+# map template alias -> failed step index
+failure_map: dict[str, Optional[int]] = {
+ "from_image": 0,
+ "from_template": 0,
+ "from_dockerfile": 0,
+ "from_image_registry": 0,
+ "from_aws_registry": 0,
+ "from_gcp_registry": 0,
+ "copy": None,
+ "copy_items": None,
+ "remove": 1,
+ "rename": 1,
+ "make_dir": 1,
+ "make_symlink": 1,
+ "run_cmd": 1,
+ "set_workdir": 1,
+ "set_user": 1,
+ "pip_install": 1,
+ "npm_install": 1,
+ "apt_install": 1,
+ "git_clone": 1,
+ "set_start_cmd": 1,
+ "add_mcp_server": None,
+ "beta_dev_container_prebuild": 1,
+ "beta_set_dev_container_start": 1,
+}
+
+
[email protected](autouse=True)
+def mock_template_build(monkeypatch):
+ def mock_request_build(client, name: str, cpu_count: int, memory_mb: int):
+ return SimpleNamespace(template_id=name, build_id=str(uuid4()))
+
+ def mock_trigger_build(client, template_id: str, build_id: str, template):
+ return None
+
+ def mock_get_build_status(
+ client, template_id: str, build_id: str, logs_offset: int
+ ):
+ step = failure_map[template_id]
+ reason = SimpleNamespace(
+ message="Mocked API build error",
+ log_entries=[],
+ step=str(step) if step is not None else None,
+ )
+ return SimpleNamespace(
+ status=TemplateBuildStatus.ERROR,
+ log_entries=[],
+ reason=reason,
+ )
+
+ monkeypatch.setattr(template_sync_main, "request_build", mock_request_build)
+ monkeypatch.setattr(template_sync_main, "trigger_build", mock_trigger_build)
+ monkeypatch.setattr(build_api_mod, "get_build_status", mock_get_build_status)
+
def _expect_to_throw_and_check_trace(func, expected_method: str):
try:
@@ -34,7 +95,7 @@ def test_traces_on_from_image(build):
template = Template()
template = template.from_image("e2b.dev/this-image-does-not-exist")
_expect_to_throw_and_check_trace(
- lambda: build(template, skip_cache=True), "from_image"
+ lambda: build(template, alias="from_image", skip_cache=True), "from_image"
)
@@ -42,7 +103,7 @@ def test_traces_on_from_image(build):
def test_traces_on_from_template(build):
template = Template().from_template("this-template-does-not-exist")
_expect_to_throw_and_check_trace(
- lambda: build(template, skip_cache=True), "from_template"
+ lambda: build(template, alias="from_template", skip_cache=True), "from_template"
)
@@ -51,7 +112,8 @@ def test_traces_on_from_dockerfile(build):
template = Template()
template = template.from_dockerfile("FROM ubuntu:22.04\nRUN nonexistent")
_expect_to_throw_and_check_trace(
- lambda: build(template, skip_cache=True), "from_dockerfile"
+ lambda: build(template, alias="from_dockerfile", skip_cache=True),
+ "from_dockerfile",
)
@@ -64,7 +126,8 @@ def test_traces_on_from_image_registry(build):
password="test",
)
_expect_to_throw_and_check_trace(
- lambda: build(template, skip_cache=True), "from_image"
+ lambda: build(template, alias="from_image_registry", skip_cache=True),
+ "from_image",
)
@@ -78,7 +141,7 @@ def test_traces_on_from_aws_registry(build):
region="us-east-1",
)
_expect_to_throw_and_check_trace(
- lambda: build(template, skip_cache=True), "from_aws_registry"
+ lambda: build(template, alias="from_aws_registry"), "from_aws_registry"
)
@@ -92,7 +155,7 @@ def test_traces_on_from_gcp_registry(build):
},
)
_expect_to_throw_and_check_trace(
- lambda: build(template, skip_cache=True), "from_gcp_registry"
+ lambda: build(template, alias="from_gcp_registry"), "from_gcp_registry"
)
@@ -101,7 +164,7 @@ def test_traces_on_copy(build):
template = Template()
template = template.from_base_image()
template = template.skip_cache().copy(non_existent_path, non_existent_path)
- _expect_to_throw_and_check_trace(lambda: build(template), "copy")
+ _expect_to_throw_and_check_trace(lambda: build(template, alias="copy"), "copy")
@pytest.mark.skip_debug()
@@ -111,7 +174,9 @@ def test_traces_on_copyItems(build):
template = template.skip_cache().copy_items(
[CopyItem(src=non_existent_path, dest=non_existent_path)]
)
- _expect_to_throw_and_check_trace(lambda: build(template), "copy_items")
+ _expect_to_throw_and_check_trace(
+ lambda: build(template, alias="copy_items"), "copy_items"
+ )
@pytest.mark.skip_debug()
@@ -119,7 +184,7 @@ def test_traces_on_remove(build):
template = Template()
template = template.from_base_image()
template = template.skip_cache().remove(non_existent_path)
- _expect_to_throw_and_check_trace(lambda: build(template), "remove")
+ _expect_to_throw_and_check_trace(lambda: build(template, alias="remove"), "remove")
@pytest.mark.skip_debug()
@@ -127,7 +192,7 @@ def test_traces_on_rename(build):
template = Template()
template = template.from_base_image()
template = template.skip_cache().rename(non_existent_path, "/tmp/dest.txt")
- _expect_to_throw_and_check_trace(lambda: build(template), "rename")
+ _expect_to_throw_and_check_trace(lambda: build(template, alias="rename"), "rename")
@pytest.mark.skip_debug()
@@ -135,7 +200,9 @@ def test_traces_on_make_dir(build):
template = Template()
template = template.from_base_image()
template = template.set_user("root").skip_cache().make_dir("/root/.bashrc")
- _expect_to_throw_and_check_trace(lambda: build(template), "make_dir")
+ _expect_to_throw_and_check_trace(
+ lambda: build(template, alias="make_dir"), "make_dir"
+ )
@pytest.mark.skip_debug()
@@ -143,7 +210,9 @@ def test_traces_on_make_symlink(build):
template = Template()
template = template.from_base_image()
template = template.skip_cache().make_symlink(".bashrc", ".bashrc")
- _expect_to_throw_and_check_trace(lambda: build(template), "make_symlink")
+ _expect_to_throw_and_check_trace(
+ lambda: build(template, alias="make_symlink"), "make_symlink"
+ )
@pytest.mark.skip_debug()
@@ -151,7 +220,9 @@ def test_traces_on_run_cmd(build):
template = Template()
template = template.from_base_image()
template = template.skip_cache().run_cmd(f"cat {non_existent_path}")
- _expect_to_throw_and_check_trace(lambda: build(template), "run_cmd")
+ _expect_to_throw_and_check_trace(
+ lambda: build(template, alias="run_cmd"), "run_cmd"
+ )
@pytest.mark.skip_debug()
@@ -159,7 +230,9 @@ def test_traces_on_set_workdir(build):
template = Template()
template = template.from_base_image()
template = template.set_user("root").skip_cache().set_workdir("/root/.bashrc")
- _expect_to_throw_and_check_trace(lambda: build(template), "set_workdir")
+ _expect_to_throw_and_check_trace(
+ lambda: build(template, alias="set_workdir"), "set_workdir"
+ )
@pytest.mark.skip_debug()
@@ -167,7 +240,9 @@ def test_traces_on_set_user(build):
template = Template()
template = template.from_base_image()
template = template.skip_cache().set_user("; exit 1")
- _expect_to_throw_and_check_trace(lambda: build(template), "set_user")
+ _expect_to_throw_and_check_trace(
+ lambda: build(template, alias="set_user"), "set_user"
+ )
@pytest.mark.skip_debug()
@@ -175,7 +250,9 @@ def test_traces_on_pip_install(build):
template = Template()
template = template.from_base_image()
template = template.skip_cache().pip_install("nonexistent-package")
- _expect_to_throw_and_check_trace(lambda: build(template), "pip_install")
+ _expect_to_throw_and_check_trace(
+ lambda: build(template, alias="pip_install"), "pip_install"
+ )
@pytest.mark.skip_debug()
@@ -183,7 +260,9 @@ def test_traces_on_npm_install(build):
template = Template()
template = template.from_base_image()
template = template.skip_cache().npm_install("nonexistent-package")
- _expect_to_throw_and_check_trace(lambda: build(template), "npm_install")
+ _expect_to_throw_and_check_trace(
+ lambda: build(template, alias="npm_install"), "npm_install"
+ )
@pytest.mark.skip_debug()
@@ -191,7 +270,9 @@ def test_traces_on_apt_install(build):
template = Template()
template = template.from_base_image()
template = template.skip_cache().apt_install("nonexistent-package")
- _expect_to_throw_and_check_trace(lambda: build(template), "apt_install")
+ _expect_to_throw_and_check_trace(
+ lambda: build(template, alias="apt_install"), "apt_install"
+ )
@pytest.mark.skip_debug()
@@ -199,7 +280,9 @@ def test_traces_on_git_clone(build):
template = Template()
template = template.from_base_image()
template = template.skip_cache().git_clone("https://github.com/repo.git")
- _expect_to_throw_and_check_trace(lambda: build(template), "git_clone")
+ _expect_to_throw_and_check_trace(
+ lambda: build(template, alias="git_clone"), "git_clone"
+ )
@pytest.mark.skip_debug()
@@ -209,7 +292,9 @@ def test_traces_on_set_start_cmd(build):
template = template.set_start_cmd(
f"./{non_existent_path}", wait_for_timeout(10_000)
)
- _expect_to_throw_and_check_trace(lambda: build(template), "set_start_cmd")
+ _expect_to_throw_and_check_trace(
+ lambda: build(template, alias="set_start_cmd"), "set_start_cmd"
+ )
@pytest.mark.skip_debug()
@@ -227,7 +312,8 @@ def test_traces_on_dev_container_prebuild(build):
template = template.from_template("devcontainer")
template = template.skip_cache().beta_dev_container_prebuild(non_existent_path)
_expect_to_throw_and_check_trace(
- lambda: build(template), "beta_dev_container_prebuild"
+ lambda: build(template, alias="beta_dev_container_prebuild"),
+ "beta_dev_container_prebuild",
)
@@ -237,5 +323,6 @@ def test_traces_on_set_dev_container_start(build):
template = template.from_template("devcontainer")
template = template.beta_set_dev_container_start(non_existent_path)
_expect_to_throw_and_check_trace(
- lambda: build(template), "beta_set_dev_container_start"
+ lambda: build(template, alias="beta_set_dev_container_start"),
+ "beta_set_dev_container_start",
)
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 7bd2be1ec..0eedb13e1 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -322,7 +322,7 @@ importers:
version: 6.0.5
'@vitest/coverage-v8':
specifier: ^3.2.4
json2md:
specifier: ^2.0.1
version: 2.0.1
@@ -340,7 +340,7 @@ importers:
version: 5.2.2
vitest:
specifier: ^3.2.4
packages/js-sdk:
dependencies:
@@ -398,7 +398,7 @@ importers:
'@vitest/browser':
specifier: ^3.1.1
dotenv:
specifier: ^16.4.5
version: 16.4.5
@@ -411,6 +411,9 @@ importers:
knip:
specifier: ^5.43.6
version: 5.43.6(@types/[email protected])([email protected])
+ msw:
+ specifier: ^2.12.3
+ version: 2.12.3(@types/[email protected])([email protected])
npm-check-updates:
specifier: ^16.14.20
version: 16.14.20
@@ -440,7 +443,7 @@ importers:
version: 5.5.3
vitest:
specifier: ^3.1.1
vitest-browser-react:
specifier: ^0.1.1
@@ -632,15 +635,6 @@ packages:
'@bufbuild/[email protected]':
resolution: {integrity: sha512-vLu7SRY84CV/Dd+NUdgtidn2hS5hSMUC1vDBY0VcviTdgRYkU43vIz3vIFbmx14cX1r+mM7WjzE5Fl1fGEM0RQ==}
- '@bundled-es-modules/[email protected]':
- resolution: {integrity: sha512-8o+5fRPLNbjbdGRRmJj3h6Hh1AQJf2dk3qQ/5ZFb+PXkRNiSoMGGUKlsgLfrxneb72axVJyIYji64E2+nNfYyw==}
-
- '@bundled-es-modules/[email protected]':
- resolution: {integrity: sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg==}
-
- '@bundled-es-modules/[email protected]':
- resolution: {integrity: sha512-dvMHbL464C0zI+Yqxbz6kZ5TOEp7GLW+pry/RWndAR8MJQAXZ2rPmIs8tziTZjeIyhSNZgZbCePtfSbdWqStJw==}
-
'@changesets/[email protected]':
resolution: {integrity: sha512-6BLOQUscTpZeGljvyQXlWOItQyU71kCdGz7Pi8H8zdw6BI0g3m43iL4xKUVPWtG+qrrL9DTjpdn8eYuCQSRpow==}
@@ -1269,8 +1263,8 @@ packages:
'@motionone/[email protected]':
resolution: {integrity: sha512-p0YncgU+iklvYr/Dq4NobTRdAPv9PveRDUXabPEeOjBLSO/1FNB2phNTZxOxpi1/GZwYpAoECEa0Wam+nsmhSw==}
- '@mswjs/[email protected]':
- resolution: {integrity: sha512-wK+5pLK5XFmgtH3aQ2YVvA3HohS3xqV/OxuVOdNx9Wpnz7VE/fnC+e1A7ln6LFYeck7gOJ/dsZV6OLplOtAJ2w==}
+ '@mswjs/[email protected]':
+ resolution: {integrity: sha512-EFd6cVbHsgLa6wa4RljGj6Wk75qoHxUSyc5asLyyPSyuhIcdS2Q3Phw6ImS1q+CkALthJRShiYfKANcQMuMqsQ==}
engines: {node: '>=18'}
@@ -2790,9 +2784,6 @@ packages:
resolution: {integrity: sha512-P63Zd/JUGq+PdrM1lv0Wv5SBYeA2+CORvbrXbngriYY0jzLUWfQMQQxOhjONEz/wlHOAxOdY7CY65rgQdTjq2w==}
- '@types/[email protected]':
- resolution: {integrity: sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==}
-
resolution: {integrity: sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==}
@@ -2956,9 +2947,6 @@ packages:
resolution: {integrity: sha512-HsJ+z3QuETzP3cswwtzt2vEIiHBk/dCcHGhbmG5X3ecnwFD/lPrMpliGXxSCg03L9AhrdwA4Oz/qfspkDW+xGQ==}
- '@types/[email protected]':
- resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==}
-
resolution: {integrity: sha512-d0XxK3YTObnWVp6rZuev3c49+j4Lo8g4L1ZRm9z5L0xpoZycUPshHgczK5gsUMaZOstjVYYi09p5gYvUtfChYw==}
@@ -3812,9 +3800,9 @@ packages:
resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==}
- resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==}
- engines: {node: '>= 0.6'}
+ resolution: {integrity: sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==}
+ engines: {node: '>=18'}
resolution: {integrity: sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==}
@@ -5858,8 +5846,8 @@ packages:
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
- resolution: {integrity: sha512-BIodwZ19RWfCbYTxWTUfTXc+sg4OwjCAgxU1ZsgmggX/7S3LdUifsbUPJs61j0rWb19CZRGY5if77duhc0uXzw==}
+ resolution: {integrity: sha512-/5rpGC0eK8LlFqsHaBmL19/PVKxu/CCt8pO1vzp9X6SDLsRDh/Ccudkf3Ur5lyaKxJz9ndAx+LaThdv0ySqB6A==}
engines: {node: '>=18'}
hasBin: true
peerDependencies:
@@ -6498,9 +6486,6 @@ packages:
resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==}
- resolution: {integrity: sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==}
-
resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==}
engines: {node: '>=6'}
@@ -6509,17 +6494,10 @@ packages:
resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==}
engines: {node: '>=6'}
- resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
- engines: {node: '>=6'}
-
resolution: {integrity: sha512-FLpr4flz5xZTSJxSeaheeMKN/EDzMdK7b8PTOC6a5PYFKTucWbdqjgqaEyH0shFiSJrVB1+Qqi4Tk19ccU6Aug==}
engines: {node: '>=12.20'}
- resolution: {integrity: sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==}
-
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
@@ -6688,9 +6666,6 @@ packages:
resolution: {integrity: sha512-nQFEv9gRw6SJAwWD2LrL0NmQvAcO7FBwJbwmr2ttPAacfy0xuiOjE5zt+zM4xDyuyvUaxBi/9gb2SoCyNEVJcw==}
engines: {node: '>=8.6.0'}
- resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==}
-
resolution: {integrity: sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==}
@@ -6721,6 +6696,9 @@ packages:
resolution: {integrity: sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==}
engines: {node: '>= 4'}
+ resolution: {integrity: sha512-LPRKoHnLKd/r3dVxcwO7vhCW+orkOGj9ViueosEBK6ie89CijnfRlhaDhHq/3Hxu4CkWQtxwlBG0mzTQY6uQjw==}
+
resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==}
engines: {iojs: '>=1.0.0', node: '>=0.10.0'}
@@ -7161,6 +7139,10 @@ packages:
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
engines: {node: '>= 0.4'}
+ resolution: {integrity: sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng==}
+ engines: {node: '>=20'}
+
resolution: {integrity: sha512-3mFKyCo/MBcgyOTlrY8T7odzZFx+w+qKSMAmdFzRvqBfLlSigU6TZnlFHK0lkMwj9Bj8OYU+9yW9lmGuS0QEnQ==}
@@ -7272,6 +7254,13 @@ packages:
resolution: {integrity: sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==}
engines: {node: '>=12'}
+ resolution: {integrity: sha512-lJX2dEWx0SGH4O6p+7FPwYmJ/bu1JbcGJ8RLaG9b7liIgZ85itUVEPbMtWRVrde/0fnDPEPHW10ZsKW3kVsE9A==}
+
+ resolution: {integrity: sha512-8PWx8tvC4jDB39BQw1m4x8y5MH1BcQ5xHeL2n7UVFulMPH/3Q0uiamahFJ3lXA0zO2SUyRXuVVbWSDmstlt9YA==}
+ hasBin: true
+
resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==}
engines: {node: '>=4'}
@@ -7287,9 +7276,9 @@ packages:
resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==}
engines: {node: '>=6'}
- resolution: {integrity: sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==}
- engines: {node: '>=6'}
+ resolution: {integrity: sha512-kXuRi1mtaKMrsLUxz3sQYvVl37B0Ns6MzfrtV5DvJceE9bPyspOqk9xxv7XbZWcfLWbFmm997vl83qUWVJA64w==}
+ engines: {node: '>=16'}
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
@@ -7381,6 +7370,10 @@ packages:
resolution: {integrity: sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==}
engines: {node: '>=16'}
+ resolution: {integrity: sha512-xxCJm+Bckc6kQBknN7i9fnP/xobQRsRQxR01CztFkp/h++yfVxUUcmMgfR2HttJx/dpWjS9ubVuyspJv24Q9DA==}
+ engines: {node: '>=20'}
+
resolution: {integrity: sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==}
@@ -7534,13 +7527,12 @@ packages:
resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==}
engines: {node: '>= 4.0.0'}
- resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==}
- engines: {node: '>= 4.0.0'}
-
resolution: {integrity: sha512-aqrHaVBWW1JVKBHmGo33T5TxeL0qWzfvjWokObHA9bYmN7eNDkwOxmLjhioHl9878qDFMAaT51XNroRyuz7WxA==}
+ resolution: {integrity: sha512-IiSk4HlzAMqTUseHHe3VhIGyuFmN90zMTpD3Z3y8jeQbzLIq500MVM7Jq2vUAnTKAFPJrqwkzr6PoTcPhGcOiw==}
+
resolution: {integrity: sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==}
engines: {node: '>=8'}
@@ -7573,9 +7565,6 @@ packages:
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
- resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==}
-
resolution: {integrity: sha512-3FT9PRuRdbB9HfXhEq35u4oZkvpJ5kuYbpqhCfmiZyReuRgpnhDlbr2ZEnnuS0RrJAPn6l23xjFg9kpDM+Ms7w==}
engines: {node: '>=10'}
@@ -8252,22 +8241,6 @@ snapshots:
'@bufbuild/[email protected]': {}
- '@bundled-es-modules/[email protected]':
- dependencies:
- cookie: 0.7.2
- optional: true
-
- '@bundled-es-modules/[email protected]':
- dependencies:
- statuses: 2.0.2
- optional: true
-
- '@bundled-es-modules/[email protected]':
- dependencies:
- '@types/tough-cookie': 4.0.5
- tough-cookie: 4.1.4
- optional: true
-
'@changesets/[email protected]':
dependencies:
extendable-error: 0.1.7
@@ -8840,7 +8813,7 @@ snapshots:
hey-listen: 1.0.8
tslib: 2.6.2
- '@mswjs/[email protected]':
+ '@mswjs/[email protected]':
dependencies:
'@open-draft/deferred-promise': 2.2.0
'@open-draft/logger': 0.3.0
@@ -8848,7 +8821,6 @@ snapshots:
is-node-process: 1.2.0
outvariant: 1.4.3
strict-event-emitter: 0.5.1
- optional: true
dependencies:
@@ -9150,17 +9122,14 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@open-draft/[email protected]':
- optional: true
+ '@open-draft/[email protected]': {}
'@open-draft/[email protected]':
dependencies:
is-node-process: 1.2.0
outvariant: 1.4.3
- optional: true
- '@open-draft/[email protected]':
- optional: true
+ '@open-draft/[email protected]': {}
'@opentelemetry/[email protected]':
dependencies:
@@ -10651,9 +10620,6 @@ snapshots:
dependencies:
'@types/node': 20.19.19
- '@types/[email protected]':
- optional: true
-
'@types/[email protected]': {}
'@types/[email protected]': {}
@@ -10800,8 +10766,7 @@ snapshots:
'@types/[email protected]': {}
- '@types/[email protected]':
- optional: true
+ '@types/[email protected]': {}
dependencies:
@@ -10811,9 +10776,6 @@ snapshots:
dependencies:
'@types/node': 20.19.19
- '@types/[email protected]':
- optional: true
-
'@types/[email protected]': {}
'@types/[email protected]': {}
@@ -11118,16 +11080,16 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
'@testing-library/dom': 10.4.0
'@testing-library/user-event': 14.6.1(@testing-library/[email protected])
'@vitest/utils': 3.1.1
magic-string: 0.30.17
sirv: 3.0.1
tinyrainbow: 2.0.0
optionalDependencies:
playwright: 1.55.1
@@ -11137,7 +11099,7 @@ snapshots:
- utf-8-validate
- vite
dependencies:
'@ampproject/remapping': 2.3.0
'@bcoe/v8-coverage': 1.0.2
@@ -11152,7 +11114,7 @@ snapshots:
std-env: 3.9.0
test-exclude: 7.0.1
tinyrainbow: 2.0.0
transitivePeerDependencies:
- supports-color
@@ -11171,22 +11133,22 @@ snapshots:
chai: 5.2.0
tinyrainbow: 2.0.0
dependencies:
'@vitest/spy': 3.1.1
estree-walker: 3.0.3
magic-string: 0.30.17
optionalDependencies:
+ msw: 2.12.3(@types/[email protected])([email protected])
dependencies:
'@vitest/spy': 3.2.4
estree-walker: 3.0.3
magic-string: 0.30.17
optionalDependencies:
+ msw: 2.12.3(@types/[email protected])([email protected])
'@vitest/[email protected]':
@@ -11836,7 +11798,6 @@ snapshots:
string-width: 4.2.3
strip-ansi: 6.0.1
wrap-ansi: 7.0.0
- optional: true
optional: true
@@ -11906,8 +11867,7 @@ snapshots:
- optional: true
dependencies:
@@ -13087,8 +13047,7 @@ snapshots:
- optional: true
dependencies:
@@ -13183,8 +13142,7 @@ snapshots:
dependencies:
'@types/hast': 3.0.4
- optional: true
@@ -13464,8 +13422,7 @@ snapshots:
- optional: true
@@ -14516,25 +14473,25 @@ snapshots:
dependencies:
- '@bundled-es-modules/cookie': 2.0.1
- '@bundled-es-modules/statuses': 1.0.1
- '@bundled-es-modules/tough-cookie': 0.1.6
'@inquirer/confirm': 5.1.19(@types/[email protected])
- '@mswjs/interceptors': 0.37.6
+ '@mswjs/interceptors': 0.40.0
'@open-draft/deferred-promise': 2.2.0
- '@open-draft/until': 2.1.0
- '@types/cookie': 0.6.0
'@types/statuses': 2.0.6
+ cookie: 1.1.1
graphql: 16.12.0
headers-polyfill: 4.0.3
is-node-process: 1.2.0
outvariant: 1.4.3
path-to-regexp: 6.3.0
picocolors: 1.1.1
+ rettime: 0.7.0
+ statuses: 2.0.2
strict-event-emitter: 0.5.1
- type-fest: 4.41.0
+ tough-cookie: 6.0.0
+ type-fest: 5.2.0
+ until-async: 3.0.2
yargs: 17.7.2
optionalDependencies:
typescript: 5.2.2
@@ -14542,31 +14499,30 @@ snapshots:
- '@types/node'
optional: true
dependencies:
- '@bundled-es-modules/cookie': 2.0.1
- '@bundled-es-modules/statuses': 1.0.1
- '@bundled-es-modules/tough-cookie': 0.1.6
'@inquirer/confirm': 5.1.19(@types/[email protected])
- '@mswjs/interceptors': 0.37.6
+ '@mswjs/interceptors': 0.40.0
'@open-draft/deferred-promise': 2.2.0
- '@open-draft/until': 2.1.0
- '@types/cookie': 0.6.0
'@types/statuses': 2.0.6
+ cookie: 1.1.1
graphql: 16.12.0
headers-polyfill: 4.0.3
is-node-process: 1.2.0
outvariant: 1.4.3
path-to-regexp: 6.3.0
picocolors: 1.1.1
+ rettime: 0.7.0
+ statuses: 2.0.2
strict-event-emitter: 0.5.1
- type-fest: 4.41.0
+ tough-cookie: 6.0.0
+ type-fest: 5.2.0
+ until-async: 3.0.2
yargs: 17.7.2
optionalDependencies:
typescript: 5.5.3
transitivePeerDependencies:
- '@types/node'
- optional: true
@@ -14950,8 +14906,7 @@ snapshots:
type-check: 0.4.0
word-wrap: 1.2.5
- optional: true
dependencies:
@@ -15082,8 +15037,7 @@ snapshots:
lru-cache: 11.1.0
minipass: 7.1.2
- optional: true
dependencies:
@@ -15269,25 +15223,14 @@ snapshots:
- dependencies:
- punycode: 2.3.1
- optional: true
-
- optional: true
-
dependencies:
escape-goat: 4.0.0
- optional: true
-
@@ -15519,9 +15462,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
- optional: true
-
@@ -15548,6 +15488,8 @@ snapshots:
+
@@ -15914,8 +15856,7 @@ snapshots:
- optional: true
@@ -15926,8 +15867,7 @@ snapshots:
- optional: true
dependencies:
@@ -16073,6 +16013,8 @@ snapshots:
+
@@ -16192,6 +16134,12 @@ snapshots:
+
+ dependencies:
+ tldts-core: 7.0.19
+
@@ -16202,13 +16150,9 @@ snapshots:
dependencies:
- psl: 1.15.0
- punycode: 2.3.1
- universalify: 0.2.0
- url-parse: 1.5.10
- optional: true
+ tldts: 7.0.19
@@ -16329,6 +16273,10 @@ snapshots:
+ dependencies:
+ tagged-tag: 1.0.0
+
@@ -16528,9 +16476,6 @@ snapshots:
- optional: true
-
dependencies:
acorn: 8.14.0
@@ -16538,13 +16483,15 @@ snapshots:
webpack-sources: 3.2.3
webpack-virtual-modules: 0.5.0
+
dependencies:
browserslist: 4.21.10
- escalade: 3.1.1
- picocolors: 1.0.0
+ escalade: 3.2.0
+ picocolors: 1.1.1
dependencies:
@@ -16581,12 +16528,6 @@ snapshots:
dependencies:
punycode: 2.3.0
- dependencies:
- querystringify: 2.2.0
- requires-port: 1.0.0
- optional: true
-
dependencies:
react: 18.2.0
@@ -16721,18 +16662,18 @@ snapshots:
dependencies:
react: 18.3.1
react-dom: 18.2.0([email protected])
optionalDependencies:
'@types/react': 18.3.11
'@types/react-dom': 18.3.1
dependencies:
'@vitest/expect': 3.1.1
'@vitest/pretty-format': 3.1.1
'@vitest/runner': 3.1.1
'@vitest/snapshot': 3.1.1
@@ -16753,7 +16694,7 @@ snapshots:
why-is-node-running: 2.3.0
optionalDependencies:
'@types/node': 20.19.19
transitivePeerDependencies:
- jiti
- less
@@ -16768,11 +16709,11 @@ snapshots:
- tsx
- yaml
dependencies:
'@types/chai': 5.2.2
'@vitest/expect': 3.2.4
'@vitest/pretty-format': 3.2.4
'@vitest/runner': 3.2.4
'@vitest/snapshot': 3.2.4
@@ -17076,7 +17017,6 @@ snapshots:
string-width: 4.2.3
y18n: 5.0.8
yargs-parser: 21.1.1
- optional: true