Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
test: stabilize cross-platform unit fixtures
MagicLizic7b7cba445b2
diff --git a/apps/desktop/src/main/__tests__/linuxInstallation.test.ts b/apps/desktop/src/main/__tests__/linuxInstallation.test.tsindex d4d134188e..a68f8e7ea4 100644--- a/apps/desktop/src/main/__tests__/linuxInstallation.test.ts+++ b/apps/desktop/src/main/__tests__/linuxInstallation.test.ts@@ -2,8 +2,9 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest';import fs from 'node:fs';import os from 'node:os';import path from 'node:path';-import { execFileSync, spawnSync } from 'node:child_process';+import { execFile, execFileSync, spawnSync } from 'node:child_process';import { createHash } from 'node:crypto';+import { promisify } from 'node:util';import {checkDebianManagedInstallation,findLinuxUserInstallation,@@ -74,13 +75,12 @@ describe.skipIf(process.platform !== 'linux')('user installer transaction smokelet prefix: string;const installer = path.resolve(__dirname, '../../../resources/linux/install-user.sh');const packages = new Map<string, { file: string; digest: string; size: number }>();- // Six bsdtar+ar fixtures under a contended Linux unit shard exceed vitest's- // 10s hookTimeout (CI: 10758ms). Spawn timeouts below are already 15s.- beforeAll(() => {+ const execFileAsync = promisify(execFile);+ beforeAll(async () => {root = fs.mkdtempSync(path.join(os.tmpdir(), 'cindy-install-test-'));prefix = path.join(root, 'home', "Cindy's space $literal");fs.mkdirSync(path.join(root, 'home'));- for (const version of ['1.0.0', '1.0.1', '1.0.2', '1.0.3', '1.0.4', '1.0.5']) {+ const results = await Promise.allSettled(['1.0.0', '1.0.1', '1.0.2', '1.0.3', '1.0.4', '1.0.5'].map(async (version) => {const pkg = path.join(root, version);const appDir = path.join(pkg, 'usr', 'lib', 'cindy');fs.mkdirSync(path.join(appDir, 'resources'), { recursive: true });@@ -93,12 +93,15 @@ describe.skipIf(process.platform !== 'linux')('user installer transaction smokefs.writeFileSync(path.join(appDir, 'resources', 'app.asar'), 'fake archive');stageLinuxBuildInfo(appDir, 'linux', process.arch, version, 'global');if (version === '1.0.3') fs.symlinkSync('/etc/passwd', path.join(appDir, 'escape'));- execFileSync('bsdtar', ['-czf', 'data.tar.gz', './usr'], { cwd: pkg });+ await execFileAsync('bsdtar', ['-czf', 'data.tar.gz', './usr'], { cwd: pkg, timeout: 15_000 });fs.writeFileSync(path.join(pkg, 'debian-binary'), '2.0\n');const file = path.join(pkg, 'package.deb');- execFileSync('ar', ['rc', file, 'debian-binary', 'data.tar.gz'], { cwd: pkg });+ await execFileAsync('ar', ['rc', file, 'debian-binary', 'data.tar.gz'], { cwd: pkg, timeout: 15_000 });const bytes = fs.readFileSync(file);packages.set(version, { file, digest: createHash('sha256').update(bytes).digest('hex'), size: bytes.length });+ }));+ for (const result of results) {+ if (result.status === 'rejected') throw result.reason;}}, 30_000);afterAll(() => fs.rmSync(root, { recursive: true, force: true }));diff --git a/apps/desktop/src/main/remote-agent/__tests__/groupRelay.test.ts b/apps/desktop/src/main/remote-agent/__tests__/groupRelay.test.tsindex ba8189cd54..3634bbe1b2 100644--- a/apps/desktop/src/main/remote-agent/__tests__/groupRelay.test.ts+++ b/apps/desktop/src/main/remote-agent/__tests__/groupRelay.test.ts@@ -238,8 +238,8 @@ beforeEach(() => {root = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'cindy-group-relay-')));});-afterEach(() => {- fs.rmSync(root, { recursive: true, force: true });+afterEach(async () => {+ await fs.promises.rm(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });});let runSeq = 0;