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 {
nativeDependencyClosure,
nativeWorkspaceSettings
} from './native-dependency-lock-digest.mjs'
const lockfile = ({
pty = '[email protected](patch_hash=aa)',
addon = '7.1.1',
electron = '43.8.1'
}) => `---
lockfileVersion: '9.0'
importers:
.:
packageManagerDependencies:
pnpm: {specifier: 12.14.0, version: 12.14.0}
---
lockfileVersion: '9.0'
importers:
.:
devDependencies:
electron: {specifier: ${electron}, version: ${electron}([email protected])}
native/addon:
dependencies:
node-addon-api: {specifier: ^8.5.0, version: 8.9.2}
snapshots:
${pty}:
dependencies:
node-addon-api: ${addon}
[email protected]: {}
[email protected]: {}
[email protected]: {}
electron@${electron}([email protected]):
dependencies:
got: 11.8.6
[email protected]: {}
[email protected]: {}
`
const selection = {
packages: ['node-pty'],
versionOnly: ['electron'],
workspaces: ['native/addon']
}
describe('native dependency lock closure', () => {
it('pins native closures, workspace addons and the Electron release only', () => {
expect(nativeDependencyClosure(lockfile({}), selection)).toEqual([
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected](patch_hash=aa)'
])
for (const change of [
{ pty: '[email protected](patch_hash=bb)' },
{ addon: '7.1.0' },
{ electron: '43.9.0' }
]) {
expect(nativeDependencyClosure(lockfile(change), selection)).not.toEqual(
nativeDependencyClosure(lockfile({}), selection)
)
}
})
it('fails closed when a selected package or dependency is not locked', () => {
expect(() => nativeDependencyClosure(lockfile({}), { packages: ['missing'] })).toThrow(
/locks none of missing/
)
expect(() =>
nativeDependencyClosure(lockfile({}), { ...selection, packages: ['node-pty', 'node-gyp'] })
).toThrow(/locks none of node-gyp$/)
expect(() =>
nativeDependencyClosure(lockfile({}), { ...selection, versionOnly: ['electron', 'nw'] })
).toThrow(/locks none of nw$/)
expect(() =>
nativeDependencyClosure(lockfile({ addon: '9.9.9' }), { packages: ['node-pty'] })
).toThrow(/no snapshot for node-addon-api@9.9.9/)
})
it('keeps layout settings and native build approvals but drops resolution-only settings', () => {
const settings = `
shamefullyHoist: true
minimumReleaseAge: 4320
overrides: {a: 1}
patchedDependencies: {x: y}
allowBuilds: {node-pty: true, bun: true}
`
expect(nativeWorkspaceSettings(settings, ['[email protected](patch_hash=aa)'])).toEqual({
allowBuilds: { 'node-pty': true },
shamefullyHoist: true
})
})
})