Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Run js tests cleanup using onTestFinished
Jakub Dobrýea8f4ffb3372
diff --git a/packages/js-sdk/tests/sandbox/files/watch.test.ts b/packages/js-sdk/tests/sandbox/files/watch.test.tsindex 83fe3743b..904e7a200 100644--- a/packages/js-sdk/tests/sandbox/files/watch.test.ts+++ b/packages/js-sdk/tests/sandbox/files/watch.test.ts@@ -1,4 +1,4 @@-import { expect } from 'vitest'+import { expect, onTestFinished } from 'vitest'import { sandboxTest } from '../../setup.js'import { FilesystemEventType, NotFoundError, SandboxError } from '../../../src'@@ -38,8 +38,9 @@ sandboxTest('watch recursive directory changes', async ({ sandbox }) => {const content = 'This file will be watched.'const newContent = 'This file has been modified.'- await sandbox.files.remove(dirname)await sandbox.files.makeDir(`${dirname}/${nestedDirname}`)+ onTestFinished(() => sandbox.files.remove(dirname))+await sandbox.files.write(`${dirname}/${nestedDirname}/${filename}`, content)let trigger: () => void@@ -70,8 +71,8 @@ sandboxTest('watch recursive directory after nested folder addition', async ({ sconst filename = 'test_watch.txt'const content = 'This file will be watched.'- await sandbox.files.remove(dirname)await sandbox.files.makeDir(dirname)+ onTestFinished(() => sandbox.files.remove(dirname))let triggerFile: () => voidlet triggerFolder: () => void