mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
refactor(apple): drop dead runner code and collapse duplicated helpers (#1936)
* refactor(apple): drop dead runner code and collapse duplicated helpers Removes declarations with no consumers (findScopeElement, interactiveTypes, two unused PresentedNode convenience inits) and collapses copy-pasted logic: DataPayload now relies on the synthesized memberwise init, TvRemoteButton is String-raw-valued, point-hit sorting shares smallestElementFirst, command-id trim-or-nil lives once on RunnerCommandJournal, scroll/desktopScroll share direction and durationMs validators, and the seven inline NSError refusals use unsupportedOperationError. elementTypeName reads a table pinned by the visibility-fold parity test. The packager now skips files whose unit-test blocks were their whole body, so 10 test-only files stop shipping (and stop compiling on user machines) as empty translation units. Packaged Swift: 432.3 kB -> 427.8 kB; 56 files instead of 66. Net -144 lines. * test(apple): pin skeleton-file exclusion in the packaging guard The strip fixture always kept runtime content, so reverting the skeleton-skip branch left every guard green. The new fixture's whole body is unit-test blocks; the packaged path must be absent while a non-skeleton sibling still ships. Observed red with the skip branch disabled before re-enabling it. * refactor(apple): tighten runner cleanup boundaries
This commit is contained in:
committed by
GitHub
parent
766d42e124
commit
5676d5ff8a
@@ -115,13 +115,15 @@ describe('the real tree', () => {
|
||||
// tautological, and a name-based filter is exactly the bug it caught
|
||||
// (RunnerTapPointPolicy.swift declares a test and does not start with "RunnerTests").
|
||||
const directory = path.join(repoRoot, RUNNER_TESTS_DIR);
|
||||
const counted = fs
|
||||
.readdirSync(directory)
|
||||
.filter((entry) => entry.endsWith('.swift'))
|
||||
.reduce((total, entry) => {
|
||||
const text = fs.readFileSync(path.join(directory, entry), 'utf8');
|
||||
const countAddressableMethods = (sourceDirectory: string): number =>
|
||||
fs.readdirSync(sourceDirectory, { withFileTypes: true }).reduce((total, entry) => {
|
||||
const entryPath = path.join(sourceDirectory, entry.name);
|
||||
if (entry.isDirectory()) return total + countAddressableMethods(entryPath);
|
||||
if (!entry.isFile() || !entry.name.endsWith('.swift')) return total;
|
||||
const text = fs.readFileSync(entryPath, 'utf8');
|
||||
return total + (text.match(/^ {2}(?:[\w@]+ )*func test/gm)?.length ?? 0);
|
||||
}, 0);
|
||||
const counted = countAddressableMethods(directory);
|
||||
|
||||
expect(counted).toBeGreaterThan(0);
|
||||
expect(loadReport(repoRoot).declared).toHaveLength(counted);
|
||||
|
||||
Reference in New Issue
Block a user