Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

Wait for ASAR fixture archive handles before runtime checks

wyt582f0b9f3e87
diff --git a/test/main/quality/operator-policy-asar.test.ts b/test/main/quality/operator-policy-asar.test.ts
index a3bd87fb..2fa12a14 100644
--- a/test/main/quality/operator-policy-asar.test.ts
+++ b/test/main/quality/operator-policy-asar.test.ts
@@ -1,6 +1,7 @@
import { describe, expect, it } from 'vitest';
import { createRequire } from 'node:module';
import { spawnSync } from 'node:child_process';
+import { finished } from 'node:stream/promises';
import * as fs from 'node:fs';
import * as os from 'node:os';
import * as path from 'node:path';
@@ -28,7 +29,10 @@ describe('operator policy packaged runtime', () => {
copy(`node_modules/${dep}`);
}
const unpack = build.asarUnpack.map((pattern: string) => path.join(stage, pattern).replaceAll('\\', '/'));
- await createPackageWithOptions(stage, archive, { unpack: `{${unpack.join(',')}}` });
+ // asar 3 returns its output stream before the archive handle closes.
+ // Windows must not read or remove the fixture until that close completes.
+ const output = await createPackageWithOptions(stage, archive, { unpack: `{${unpack.join(',')}}` });
+ await finished(output);
expect(statFile(archive, 'src/main/quality/operator-worker.js').unpacked).not.toBe(true);
const launcher = path.join(root, 'launch.cjs');
fs.writeFileSync(launcher, `
@@ -63,6 +67,9 @@ describe('operator policy packaged runtime', () => {
const result = spawnSync(process.execPath, [launcher], { cwd: root, env, encoding: 'utf8', timeout: 20000 });
expect(result.status, result.stderr || result.stdout || String(result.error)).toBe(0);
expect(result.stdout).toContain('POLICY_ASAR_OK');
- } finally { fs.rmSync(root, { recursive: true, force: true }); }
+ } finally {
+ // Electron's fs wrapper treats ASARs as directories; delete the real archive.
+ require('original-fs').rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 });
+ }
}, 30000);
});