mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
fix(sandbox): harden enforcement validation and backup handling
This commit is contained in:
1 parent
f315dda3f3
commit
0481160f5e
13 files changed
+180
-101
No files matched your search
@@ -138,6 +138,17 @@ const execSyncMock = execSync as any
|
||||
const childSpawnSyncMock = spawnSync as any
|
||||
const readdirSyncMock = readdirSync as any
|
||||
|
||||
const routeVersionProbeThroughExecSyncStub = () => {
|
||||
childSpawnSyncMock.mockImplementation((file: string, args?: readonly string[]) => {
|
||||
if (Array.isArray(args) && args[0] === '--version') {
|
||||
return { status: 0, stdout: String(execSyncMock(`${file} --version`) ?? ''), stderr: '' }
|
||||
}
|
||||
return { status: 0, stdout: '', stderr: '' }
|
||||
})
|
||||
}
|
||||
|
||||
beforeEach(routeVersionProbeThroughExecSyncStub)
|
||||
|
||||
// Reset singleton before any tests run to clear any polluted state from previous test files
|
||||
beforeAll(async () => {
|
||||
const { OpenCodeServerManager } = await import('../../src/services/opencode-single-server')
|
||||
|
||||
Reference in new issue
Block a user