mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
* feat(windows): add administrator PowerShell terminal setting * fix(settings): localize administrator terminal search keywords * fix(windows): restrict elevated terminal host to Orca's runtime and requesting account * fix(windows): harden administrator terminal routing, inventory and restore * fix(build): build the Windows agent hook when electron-builder packages Windows * fix(build): build the packaged Windows agent hook for the target architecture * fix(windows): accept the development terminal runtime and test real elevation in CI * feat(windows): show administrator status and restart instructions * fix(settings): localize administrator mode search keywords * test(settings): isolate the desktop permission section in shell picker tests * Add Windows administrator restart and simplify Terminal settings * Keep administrator restart silent and settings actions within narrow panes * Keep Windows shell choices and permission guides usable at minimum width * Prevent later restarts from replaying administrator terminal reset * Fix CI route resolution and transient Windows fixture cleanup
107 lines
2.9 KiB
JavaScript
107 lines
2.9 KiB
JavaScript
import { createRequire } from 'node:module'
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
const require = createRequire(import.meta.url)
|
|
const {
|
|
buildNativeRebuildArgs,
|
|
runElectronBuilderNativeRebuild
|
|
} = require('./electron-builder-native-rebuild.cjs')
|
|
|
|
describe('electron-builder native rebuild hook', () => {
|
|
it('passes the target platform and arch to Orca native rebuild script', () => {
|
|
expect(
|
|
buildNativeRebuildArgs({
|
|
platform: { nodeName: 'darwin' },
|
|
arch: 'x64'
|
|
})
|
|
).toEqual([
|
|
'config/scripts/rebuild-native-deps.mjs',
|
|
'--platform=darwin',
|
|
'--arch=x64',
|
|
'--force'
|
|
])
|
|
})
|
|
|
|
it('returns false so electron-builder skips its optional module rebuild pass', () => {
|
|
const calls = []
|
|
const result = runElectronBuilderNativeRebuild(
|
|
{
|
|
platform: { nodeName: 'linux' },
|
|
arch: 'arm64'
|
|
},
|
|
(...args) => calls.push(args)
|
|
)
|
|
|
|
expect(result).toBe(false)
|
|
expect(calls).toEqual([
|
|
[
|
|
process.execPath,
|
|
['config/scripts/rebuild-native-deps.mjs', '--platform=linux', '--arch=arm64', '--force'],
|
|
expect.objectContaining({ stdio: 'inherit' })
|
|
]
|
|
])
|
|
})
|
|
|
|
it('reuses a prepared native runtime only for the host target', () => {
|
|
const runtime = {
|
|
environment: { ORCA_REUSE_PREPARED_NATIVE_RUNTIME: '1' },
|
|
hostPlatform: 'linux',
|
|
hostArch: 'x64'
|
|
}
|
|
|
|
expect(
|
|
buildNativeRebuildArgs(
|
|
{
|
|
platform: { nodeName: 'linux' },
|
|
arch: 'x64'
|
|
},
|
|
runtime
|
|
)
|
|
).toEqual(['config/scripts/rebuild-native-deps.mjs', '--platform=linux', '--arch=x64'])
|
|
expect(
|
|
buildNativeRebuildArgs(
|
|
{
|
|
platform: { nodeName: 'linux' },
|
|
arch: 'arm64'
|
|
},
|
|
runtime
|
|
)
|
|
).toContain('--force')
|
|
})
|
|
|
|
it('builds the native CLI launcher before packaging Windows resources', () => {
|
|
const calls = []
|
|
const result = runElectronBuilderNativeRebuild(
|
|
{
|
|
platform: { nodeName: 'win32' },
|
|
arch: 'x64'
|
|
},
|
|
(...args) => calls.push(args)
|
|
)
|
|
|
|
expect(result).toBe(false)
|
|
expect(calls).toEqual([
|
|
[
|
|
process.execPath,
|
|
['config/scripts/build-windows-cli-launcher.mjs'],
|
|
expect.objectContaining({ stdio: 'inherit' })
|
|
],
|
|
[
|
|
process.execPath,
|
|
['config/scripts/build-windows-agent-hook.mjs', '--arch', 'x64'],
|
|
expect.objectContaining({ stdio: 'inherit' })
|
|
],
|
|
[
|
|
process.execPath,
|
|
['config/scripts/rebuild-native-deps.mjs', '--platform=win32', '--arch=x64', '--force'],
|
|
expect.objectContaining({ stdio: 'inherit' })
|
|
]
|
|
])
|
|
})
|
|
|
|
it('rejects incomplete electron-builder contexts', () => {
|
|
expect(() => buildNativeRebuildArgs({ arch: 'x64' })).toThrow(/platform/)
|
|
expect(() => buildNativeRebuildArgs({ platform: { nodeName: 'linux' } })).toThrow(/arch/)
|
|
})
|
|
})
|