Skip to content

Commit 1d1cf0e

Browse files
authored
test: relocate the 2 deferred Apple runner/recording tests (closes callstack#980) (callstack#988)
Completes the callstack#983 relocation. The 2 files deferred there compute runtime fs paths (fileURLToPath/__dirname), so they needed path-depth fixes on top of import re-relativization: - runner-client.test.ts -> src/platforms/apple/core/__tests__/ (joins the rest of the Apple engine tests); repoRoot recomputed one level deeper. - recording-scripts.test.ts -> src/recording/__tests__/ (beside the overlay.ts it tests); ios-runner RecordingScripts + test/integration/support paths recomputed one level shallower. src/platforms/ios/__tests__/ is now empty (all Apple-engine tests live beside their source under apple/core and recording). Pure test relocation — tsc, oxlint, oxfmt, layering guard, fallow green; full unit suite passes (2883).
1 parent 2e0879a commit 1d1cf0e

2 files changed

Lines changed: 24 additions & 23 deletions

File tree

src/platforms/ios/__tests__/runner-client.test.ts renamed to src/platforms/apple/core/__tests__/runner-client.test.ts

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,38 @@ const { mockRunCmdStreaming, mockRepairMacOsRunnerProductsIfNeeded } = vi.hoiste
1010
mockRepairMacOsRunnerProductsIfNeeded: vi.fn(),
1111
}));
1212

13-
vi.mock('../../../utils/exec.ts', async () => {
14-
const actual =
15-
await vi.importActual<typeof import('../../../utils/exec.ts')>('../../../utils/exec.ts');
13+
vi.mock('../../../../utils/exec.ts', async () => {
14+
const actual = await vi.importActual<typeof import('../../../../utils/exec.ts')>(
15+
'../../../../utils/exec.ts',
16+
);
1617
return {
1718
...actual,
1819
runCmdStreaming: mockRunCmdStreaming,
1920
};
2021
});
2122

22-
vi.mock('../../apple/core/runner/runner-macos-products.ts', async () => {
23-
const actual = await vi.importActual<
24-
typeof import('../../apple/core/runner/runner-macos-products.ts')
25-
>('../../apple/core/runner/runner-macos-products.ts');
23+
vi.mock('../runner/runner-macos-products.ts', async () => {
24+
const actual = await vi.importActual<typeof import('../runner/runner-macos-products.ts')>(
25+
'../runner/runner-macos-products.ts',
26+
);
2627
return {
2728
...actual,
2829
repairMacOsRunnerProductsIfNeeded: mockRepairMacOsRunnerProductsIfNeeded,
2930
};
3031
});
3132

32-
import type { DeviceInfo } from '../../../kernel/device.ts';
33+
import type { DeviceInfo } from '../../../../kernel/device.ts';
3334
import {
3435
type RequestProgressEvent,
3536
withRequestProgressSink,
36-
} from '../../../daemon/request-progress.ts';
37-
import { flushDiagnosticsToSessionFile, withDiagnosticsScope } from '../../../utils/diagnostics.ts';
38-
import { AppError } from '../../../kernel/errors.ts';
39-
import { isReadOnlyRunnerCommand } from '../../apple/core/runner/runner-command-traits.ts';
37+
} from '../../../../daemon/request-progress.ts';
4038
import {
41-
withRunnerCommandId,
42-
type RunnerCommand,
43-
} from '../../apple/core/runner/runner-contract.ts';
39+
flushDiagnosticsToSessionFile,
40+
withDiagnosticsScope,
41+
} from '../../../../utils/diagnostics.ts';
42+
import { AppError } from '../../../../kernel/errors.ts';
43+
import { isReadOnlyRunnerCommand } from '../runner/runner-command-traits.ts';
44+
import { withRunnerCommandId, type RunnerCommand } from '../runner/runner-contract.ts';
4445
import {
4546
assertSafeDerivedCleanup,
4647
isRetryableRunnerError,
@@ -52,7 +53,7 @@ import {
5253
resolveRunnerMaxConcurrentDestinationsFlag,
5354
resolveRunnerSigningBuildSettings,
5455
shouldRetryRunnerConnectError,
55-
} from '../../apple/core/runner/runner-client.ts';
56+
} from '../runner/runner-client.ts';
5657
import {
5758
acquireRunnerXctestrunCacheLock,
5859
ensureXctestrunArtifact,
@@ -66,8 +67,8 @@ import {
6667
shouldDeleteRunnerDerivedRootEntry,
6768
writeRunnerCacheMetadata,
6869
xctestrunReferencesProjectRoot,
69-
} from '../../apple/core/runner/runner-xctestrun.ts';
70-
import { parseRunnerResponse } from '../../apple/core/runner/runner-session.ts';
70+
} from '../runner/runner-xctestrun.ts';
71+
import { parseRunnerResponse } from '../runner/runner-session.ts';
7172

7273
const iosSimulator: DeviceInfo = {
7374
platform: 'ios',
@@ -180,7 +181,7 @@ const runnerProtocolCommandFixtures: Record<RunnerCommand['command'], RunnerComm
180181
shutdown: { command: 'shutdown' },
181182
};
182183

183-
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../');
184+
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../../');
184185

185186
async function makeTmpDir(): Promise<string> {
186187
const tmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'agent-device-xctestrun-'));

src/platforms/ios/__tests__/recording-scripts.test.ts renamed to src/recording/__tests__/recording-scripts.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import { test } from 'vitest';
22
import assert from 'node:assert/strict';
33
import path from 'node:path';
44
import { fileURLToPath } from 'node:url';
5-
import { runCmd } from '../../../utils/exec.ts';
6-
import { getRecordingOverlaySupportWarning } from '../../../recording/overlay.ts';
5+
import { runCmd } from '../../utils/exec.ts';
6+
import { getRecordingOverlaySupportWarning } from '../overlay.ts';
77

88
const __dirname = path.dirname(fileURLToPath(import.meta.url));
99
const recordingScriptsDir = path.resolve(
1010
__dirname,
11-
'../../../../ios-runner/AgentDeviceRunner/RecordingScripts',
11+
'../../../ios-runner/AgentDeviceRunner/RecordingScripts',
1212
);
13-
const recordingTestSupportDir = path.resolve(__dirname, '../../../../test/integration/support');
13+
const recordingTestSupportDir = path.resolve(__dirname, '../../../test/integration/support');
1414
const SWIFT_TYPECHECK_TIMEOUT_MS = 60_000;
1515

1616
async function assertSwiftScriptTypechecks(scriptPath: string): Promise<void> {

0 commit comments

Comments
 (0)