From f43df158d6327369ab8f76ceb741b8ca451b00bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 1 Jul 2026 11:20:21 +0200 Subject: [PATCH] test: relocate remaining Apple-engine unit tests to apple/core (#980) Finishes the relocation started in #983, which moved 19 Apple-engine unit tests into src/platforms/apple/core/__tests__/ but deferred two files that compute runtime fs paths to native runner artifacts. Moves the last two: - recording-scripts.test.ts - runner-client.test.ts Both needed the relative import specifiers re-relativized for the deeper location, plus one extra `../` on the runtime fs paths that resolve against the repo root (the native ios-runner/ project and test/integration/support still live at the repo root; #968 only moved the TypeScript engine): - recording-scripts.test.ts: recordingScriptsDir / recordingTestSupportDir (`../../../../` -> `../../../../../`) -> ios-runner/.../RecordingScripts and test/integration/support. - runner-client.test.ts: repoRoot (`../../../../` -> `../../../../../`), which feeds the project `.tmp` dir and the ios-runner xcodeproj path. Behaviorless move. Verified: tsc --noEmit clean, both test files pass (64 tests), layering check OK, oxfmt/oxlint clean, fallow audit clean. closes #980 --- .../core}/__tests__/recording-scripts.test.ts | 8 ++-- .../core}/__tests__/runner-client.test.ts | 39 ++++++++++--------- 2 files changed, 24 insertions(+), 23 deletions(-) rename src/platforms/{ios => apple/core}/__tests__/recording-scripts.test.ts (90%) rename src/platforms/{ios => apple/core}/__tests__/runner-client.test.ts (97%) diff --git a/src/platforms/ios/__tests__/recording-scripts.test.ts b/src/platforms/apple/core/__tests__/recording-scripts.test.ts similarity index 90% rename from src/platforms/ios/__tests__/recording-scripts.test.ts rename to src/platforms/apple/core/__tests__/recording-scripts.test.ts index 59ef3c296..ad6149b34 100644 --- a/src/platforms/ios/__tests__/recording-scripts.test.ts +++ b/src/platforms/apple/core/__tests__/recording-scripts.test.ts @@ -2,15 +2,15 @@ import { test } from 'vitest'; import assert from 'node:assert/strict'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; -import { runCmd } from '../../../utils/exec.ts'; -import { getRecordingOverlaySupportWarning } from '../../../recording/overlay.ts'; +import { runCmd } from '../../../../utils/exec.ts'; +import { getRecordingOverlaySupportWarning } from '../../../../recording/overlay.ts'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const recordingScriptsDir = path.resolve( __dirname, - '../../../../ios-runner/AgentDeviceRunner/RecordingScripts', + '../../../../../ios-runner/AgentDeviceRunner/RecordingScripts', ); -const recordingTestSupportDir = path.resolve(__dirname, '../../../../test/integration/support'); +const recordingTestSupportDir = path.resolve(__dirname, '../../../../../test/integration/support'); const SWIFT_TYPECHECK_TIMEOUT_MS = 60_000; async function assertSwiftScriptTypechecks(scriptPath: string): Promise { diff --git a/src/platforms/ios/__tests__/runner-client.test.ts b/src/platforms/apple/core/__tests__/runner-client.test.ts similarity index 97% rename from src/platforms/ios/__tests__/runner-client.test.ts rename to src/platforms/apple/core/__tests__/runner-client.test.ts index b8fd46261..af986e9cf 100644 --- a/src/platforms/ios/__tests__/runner-client.test.ts +++ b/src/platforms/apple/core/__tests__/runner-client.test.ts @@ -10,37 +10,38 @@ const { mockRunCmdStreaming, mockRepairMacOsRunnerProductsIfNeeded } = vi.hoiste mockRepairMacOsRunnerProductsIfNeeded: vi.fn(), })); -vi.mock('../../../utils/exec.ts', async () => { - const actual = - await vi.importActual('../../../utils/exec.ts'); +vi.mock('../../../../utils/exec.ts', async () => { + const actual = await vi.importActual( + '../../../../utils/exec.ts', + ); return { ...actual, runCmdStreaming: mockRunCmdStreaming, }; }); -vi.mock('../../apple/core/runner/runner-macos-products.ts', async () => { - const actual = await vi.importActual< - typeof import('../../apple/core/runner/runner-macos-products.ts') - >('../../apple/core/runner/runner-macos-products.ts'); +vi.mock('../runner/runner-macos-products.ts', async () => { + const actual = await vi.importActual( + '../runner/runner-macos-products.ts', + ); return { ...actual, repairMacOsRunnerProductsIfNeeded: mockRepairMacOsRunnerProductsIfNeeded, }; }); -import type { DeviceInfo } from '../../../kernel/device.ts'; +import type { DeviceInfo } from '../../../../kernel/device.ts'; import { type RequestProgressEvent, withRequestProgressSink, -} from '../../../daemon/request-progress.ts'; -import { flushDiagnosticsToSessionFile, withDiagnosticsScope } from '../../../utils/diagnostics.ts'; -import { AppError } from '../../../kernel/errors.ts'; -import { isReadOnlyRunnerCommand } from '../../apple/core/runner/runner-command-traits.ts'; +} from '../../../../daemon/request-progress.ts'; import { - withRunnerCommandId, - type RunnerCommand, -} from '../../apple/core/runner/runner-contract.ts'; + flushDiagnosticsToSessionFile, + withDiagnosticsScope, +} from '../../../../utils/diagnostics.ts'; +import { AppError } from '../../../../kernel/errors.ts'; +import { isReadOnlyRunnerCommand } from '../runner/runner-command-traits.ts'; +import { withRunnerCommandId, type RunnerCommand } from '../runner/runner-contract.ts'; import { assertSafeDerivedCleanup, isRetryableRunnerError, @@ -52,7 +53,7 @@ import { resolveRunnerMaxConcurrentDestinationsFlag, resolveRunnerSigningBuildSettings, shouldRetryRunnerConnectError, -} from '../../apple/core/runner/runner-client.ts'; +} from '../runner/runner-client.ts'; import { acquireRunnerXctestrunCacheLock, ensureXctestrunArtifact, @@ -66,8 +67,8 @@ import { shouldDeleteRunnerDerivedRootEntry, writeRunnerCacheMetadata, xctestrunReferencesProjectRoot, -} from '../../apple/core/runner/runner-xctestrun.ts'; -import { parseRunnerResponse } from '../../apple/core/runner/runner-session.ts'; +} from '../runner/runner-xctestrun.ts'; +import { parseRunnerResponse } from '../runner/runner-session.ts'; const iosSimulator: DeviceInfo = { platform: 'ios', @@ -180,7 +181,7 @@ const runnerProtocolCommandFixtures: Record { const tmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'agent-device-xctestrun-'));