Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.
TypeScript adeagent-ideai-agentsautomationbotclaude-codecodexghosttygrok-bothermes-agentmobile-appmuseopenclawopencodeorchestrationpiruntimeterminalworktreesyc-backed
import { describe, expect, it } from 'vitest'
import { readRendererProcessMemory } from './renderer-process-memory-reader'
// Electron requires residentSet in its types, but Chromium omits it on macOS.
const source = (
getProcessMemoryInfo: () => Promise<Partial<Electron.ProcessMemoryInfo>>
): Parameters<typeof readRendererProcessMemory>[0] =>
({ getProcessMemoryInfo }) as unknown as Parameters<typeof readRendererProcessMemory>[0]
describe('readRendererProcessMemory', () => {
it('reports the private footprint in the kilobytes Electron returns', async () => {
await expect(
readRendererProcessMemory(
source(async () => ({ private: 632_832, residentSet: 1_143_808, shared: 0 }))
)
).resolves.toEqual({ privateKB: 632_832, residentKB: 1_143_808 })
})
it('omits the resident set where Chromium does not report one', async () => {
await expect(
readRendererProcessMemory(source(async () => ({ private: 1024, shared: 0 })))
).resolves.toEqual({ privateKB: 1024 })
})
it('returns null rather than throwing when the runtime withholds the read', async () => {
await expect(
readRendererProcessMemory(
source(() => Promise.reject(new Error('getProcessMemoryInfo unavailable')))
)
).resolves.toBeNull()
})
it('returns null for a non-finite private size', async () => {
await expect(
readRendererProcessMemory(source(async () => ({ private: Number.NaN, shared: 0 })))
).resolves.toBeNull()
})
})