mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-22 16:25:58 +00:00
* fix(desktop): hide Windows updater console (#56884) * test(desktop): cover hidden updater handoffs behaviorally --------- Co-authored-by: Kyssta <218078013+kyssta-exe@users.noreply.github.com>
62 lines
1.5 KiB
TypeScript
62 lines
1.5 KiB
TypeScript
import assert from 'node:assert/strict'
|
|
import type { SpawnOptions } from 'node:child_process'
|
|
|
|
import { test } from 'vitest'
|
|
|
|
import { spawnUpdaterProcess } from './updater-process'
|
|
|
|
test('spawnUpdaterProcess hides the updater console and detaches the child on Windows', () => {
|
|
const calls: Array<{ args: string[]; command: string; options: SpawnOptions }> = []
|
|
let unrefCalls = 0
|
|
|
|
const child = {
|
|
pid: 4242,
|
|
unref: () => {
|
|
unrefCalls += 1
|
|
}
|
|
}
|
|
|
|
const result = spawnUpdaterProcess(
|
|
'hermes-setup.exe',
|
|
['--update', '--branch', 'main'],
|
|
{ cwd: 'C:\\Hermes', detached: true, stdio: 'ignore' },
|
|
{
|
|
isWindows: true,
|
|
spawnProcess: (command, args, options) => {
|
|
calls.push({ args, command, options })
|
|
|
|
return child
|
|
}
|
|
}
|
|
)
|
|
|
|
assert.equal(result, child)
|
|
assert.equal(unrefCalls, 1)
|
|
assert.deepEqual(calls, [
|
|
{
|
|
args: ['--update', '--branch', 'main'],
|
|
command: 'hermes-setup.exe',
|
|
options: { cwd: 'C:\\Hermes', detached: true, stdio: 'ignore', windowsHide: true }
|
|
}
|
|
])
|
|
})
|
|
|
|
test('spawnUpdaterProcess preserves updater options off Windows', () => {
|
|
let capturedOptions: SpawnOptions | undefined
|
|
|
|
spawnUpdaterProcess(
|
|
'hermes-setup',
|
|
['--update'],
|
|
{ detached: true, stdio: 'ignore' },
|
|
{
|
|
isWindows: false,
|
|
spawnProcess: (_command, _args, options) => {
|
|
capturedOptions = options
|
|
|
|
return { unref: () => {} }
|
|
}
|
|
}
|
|
)
|
|
|
|
assert.deepEqual(capturedOptions, { detached: true, stdio: 'ignore' })
|
|
})
|