mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 08:03:39 +00:00
Fix packaged Linux node-pty floor smoke
This commit is contained in:
@@ -5,7 +5,7 @@ if (!resourcesDirectory) {
|
||||
throw new Error('linux-packaged-node-pty-floor-resources-required')
|
||||
}
|
||||
|
||||
const pty = require(join(resourcesDirectory, 'app.asar', 'node_modules', 'node-pty'))
|
||||
const pty = require(join(resourcesDirectory, 'node_modules', 'node-pty'))
|
||||
const expected = 'orca-node-pty-floor-ok'
|
||||
let output = ''
|
||||
let settled = false
|
||||
|
||||
@@ -4,6 +4,7 @@ import { isAbsolute, relative, resolve, sep } from 'node:path'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
|
||||
const FLOOR_IMAGE = 'ubuntu:20.04'
|
||||
const LINUX_EXECUTABLE = 'orca-ide'
|
||||
const FLOOR_PACKAGES = [
|
||||
'ca-certificates',
|
||||
'libasound2',
|
||||
@@ -33,7 +34,7 @@ export function packagedNodePtyFloorDockerArgs({ workspaceDirectory, appDirector
|
||||
'export DEBIAN_FRONTEND=noninteractive',
|
||||
'apt-get update -qq',
|
||||
`apt-get install -y -qq ${FLOOR_PACKAGES.join(' ')} >/dev/null`,
|
||||
`ELECTRON_RUN_AS_NODE=1 ${containerAppDirectory}/orca ` +
|
||||
`ELECTRON_RUN_AS_NODE=1 ${containerAppDirectory}/${LINUX_EXECUTABLE} ` +
|
||||
'/workspace/config/scripts/linux-packaged-node-pty-floor-child.cjs ' +
|
||||
`${containerAppDirectory}/resources`
|
||||
].join(' && ')
|
||||
@@ -69,7 +70,7 @@ export function runPackagedNodePtyFloorSmoke({
|
||||
throw new Error('linux-packaged-node-pty-floor-smoke-requires-linux')
|
||||
}
|
||||
const absoluteAppDirectory = resolve(workspaceDirectory, appDirectory)
|
||||
if (!existsSync(resolve(absoluteAppDirectory, 'orca'))) {
|
||||
if (!existsSync(resolve(absoluteAppDirectory, LINUX_EXECUTABLE))) {
|
||||
throw new Error(`linux-packaged-node-pty-floor-executable-missing: ${absoluteAppDirectory}`)
|
||||
}
|
||||
const result = spawn(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { packagedNodePtyFloorDockerArgs } from './run-linux-packaged-node-pty-floor-smoke.mjs'
|
||||
|
||||
@@ -10,7 +11,7 @@ describe('packaged node-pty Linux floor smoke', () => {
|
||||
|
||||
expect(args).toContain('type=bind,src=/repo,dst=/workspace,readonly')
|
||||
expect(args).toContain('ubuntu:20.04')
|
||||
expect(args.at(-1)).toContain('/workspace/dist/linux-arm64-unpacked/orca')
|
||||
expect(args.at(-1)).toContain('/workspace/dist/linux-arm64-unpacked/orca-ide')
|
||||
expect(args.at(-1)).toContain('ELECTRON_RUN_AS_NODE=1')
|
||||
})
|
||||
|
||||
@@ -22,4 +23,14 @@ describe('packaged node-pty Linux floor smoke', () => {
|
||||
})
|
||||
).toThrow('linux-packaged-node-pty-floor-app-directory-invalid')
|
||||
})
|
||||
|
||||
it('loads node-pty from packaged runtime resources', () => {
|
||||
const childSource = readFileSync(
|
||||
new URL('./linux-packaged-node-pty-floor-child.cjs', import.meta.url),
|
||||
'utf8'
|
||||
)
|
||||
|
||||
expect(childSource).toContain("join(resourcesDirectory, 'node_modules', 'node-pty')")
|
||||
expect(childSource).not.toContain("join(resourcesDirectory, 'app.asar'")
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user