@stag-build/phonebook 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/dist/cli.js +22 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/init.d.ts +21 -2
- package/dist/commands/init.js +33 -4
- package/dist/commands/init.js.map +1 -1
- package/dist/engines/android.d.ts +54 -0
- package/dist/engines/android.js +152 -6
- package/dist/engines/android.js.map +1 -1
- package/dist/engines/ios.d.ts +53 -4
- package/dist/engines/ios.js +142 -27
- package/dist/engines/ios.js.map +1 -1
- package/dist/errors.js +12 -1
- package/dist/errors.js.map +1 -1
- package/dist/ios/snapshotTestClass.d.ts +44 -0
- package/dist/ios/snapshotTestClass.js +115 -0
- package/dist/ios/snapshotTestClass.js.map +1 -1
- package/dist/ios/unrendered.d.ts +38 -0
- package/dist/ios/unrendered.js +92 -0
- package/dist/ios/unrendered.js.map +1 -0
- package/dist/manifest.d.ts +23 -2
- package/dist/manifest.js +58 -0
- package/dist/manifest.js.map +1 -1
- package/dist/mcp/server.d.ts +28 -0
- package/dist/mcp/server.js +232 -11
- package/dist/mcp/server.js.map +1 -1
- package/dist/png.d.ts +18 -0
- package/dist/png.js +44 -0
- package/dist/png.js.map +1 -0
- package/dist/scan/android.js +142 -16
- package/dist/scan/android.js.map +1 -1
- package/dist/scan/gaps.d.ts +52 -0
- package/dist/scan/gaps.js +169 -0
- package/dist/scan/gaps.js.map +1 -0
- package/dist/scan/ios.d.ts +44 -0
- package/dist/scan/ios.js +445 -41
- package/dist/scan/ios.js.map +1 -1
- package/dist/scan/scope.d.ts +30 -0
- package/dist/scan/scope.js +208 -0
- package/dist/scan/scope.js.map +1 -0
- package/dist/scan/stats.d.ts +12 -0
- package/dist/scan/stats.js +24 -0
- package/dist/scan/stats.js.map +1 -0
- package/dist/scan/types.d.ts +87 -1
- package/dist/site/build.js +0 -0
- package/dist/site/build.js.map +1 -1
- package/package.json +1 -1
package/dist/engines/ios.d.ts
CHANGED
|
@@ -2,6 +2,25 @@ import type { PhonebookConfig } from '../config.js';
|
|
|
2
2
|
import { type Manifest, type ManifestEntry } from '../manifest.js';
|
|
3
3
|
/** Builds the error/warning text for a `generate` run that exported zero snapshots. Exported for tests. */
|
|
4
4
|
export declare function buildEmptySnapshotsMessage(exportDir: string, scheme: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* A run that rendered some previews and did not finish, usually because a
|
|
7
|
+
* preview crashed. The bundle of what did render has been written.
|
|
8
|
+
*
|
|
9
|
+
* Thrown rather than returned so a caller that only knows the happy path — the
|
|
10
|
+
* CLI — still exits non-zero, while one that can use the partial result catches
|
|
11
|
+
* it. The crash list is worth more than a clean failure: every preview that traps
|
|
12
|
+
* costs a host-app relaunch, so it is what makes the next run shorter.
|
|
13
|
+
*/
|
|
14
|
+
export declare class IncompleteRenderError extends Error {
|
|
15
|
+
readonly manifest: Manifest;
|
|
16
|
+
readonly outputDir: string;
|
|
17
|
+
/** Container of each preview test the runner reported failed, one per test. */
|
|
18
|
+
readonly failedPreviews: string[];
|
|
19
|
+
readonly diagnosis: string[];
|
|
20
|
+
constructor(manifest: Manifest, outputDir: string,
|
|
21
|
+
/** Container of each preview test the runner reported failed, one per test. */
|
|
22
|
+
failedPreviews: string[], diagnosis: string[]);
|
|
23
|
+
}
|
|
5
24
|
/**
|
|
6
25
|
* Resolves the -only-testing:Target/Class argument so `generate` runs just the
|
|
7
26
|
* snapshot test class instead of the app's whole test suite — an unrelated
|
|
@@ -10,6 +29,23 @@ export declare function buildEmptySnapshotsMessage(exportDir: string, scheme: st
|
|
|
10
29
|
* Exported for tests.
|
|
11
30
|
*/
|
|
12
31
|
export declare function resolveOnlyTesting(config: PhonebookConfig, projectDir: string): Promise<string | undefined>;
|
|
32
|
+
/** Escapes a literal so it matches itself inside a regular expression. Exported for tests. */
|
|
33
|
+
export declare function escapeRegex(literal: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* The SNAPSHOTS_ONLY_FILTER value that renders only the previews declared in
|
|
36
|
+
* `files`, or undefined to render everything.
|
|
37
|
+
*
|
|
38
|
+
* SnapshotPreviews filters before it creates a test method, so a pattern that
|
|
39
|
+
* misses is a preview that never renders — which makes a half-resolved filter
|
|
40
|
+
* worse than none. A file whose module cannot be read (a project that is not
|
|
41
|
+
* using Xcode's synchronized folders, a target xcodebuild will not describe)
|
|
42
|
+
* therefore drops the whole filter rather than quietly dropping that file.
|
|
43
|
+
*
|
|
44
|
+
* Each pattern is anchored against the preview's synthesized fileID,
|
|
45
|
+
* "<Module>/<File>.swift", because the match is a substring search: unanchored,
|
|
46
|
+
* "Card.swift" would also claim UserCard.swift.
|
|
47
|
+
*/
|
|
48
|
+
export declare function buildSnapshotsOnlyFilter(files: string[], moduleOf: (file: string) => Promise<string | undefined>): Promise<string | undefined>;
|
|
13
49
|
/**
|
|
14
50
|
* Runs the SnapshotPreviews-backed XCTest target via xcodebuild on a simulator
|
|
15
51
|
* and harvests the exported PNG + JSON sidecar pairs into a Phonebook bundle.
|
|
@@ -21,6 +57,10 @@ export declare function resolveOnlyTesting(config: PhonebookConfig, projectDir:
|
|
|
21
57
|
export declare function generateIos(config: PhonebookConfig, projectDir: string, outputDir: string, options?: {
|
|
22
58
|
quiet?: boolean;
|
|
23
59
|
allowEmpty?: boolean;
|
|
60
|
+
/** Render only the previews declared in files with uncommitted changes. */
|
|
61
|
+
changedOnly?: boolean;
|
|
62
|
+
/** Render only the previews declared in these files (relative to projectDir). */
|
|
63
|
+
files?: string[];
|
|
24
64
|
}): Promise<Manifest>;
|
|
25
65
|
/** Shape of the JSON sidecar SnapshotPreviews writes next to each PNG. */
|
|
26
66
|
interface SnapshotSidecar {
|
|
@@ -38,6 +78,14 @@ interface SnapshotSidecar {
|
|
|
38
78
|
}
|
|
39
79
|
/** Exported for tests. Maps one PNG + sidecar to a manifest entry (minus image path). */
|
|
40
80
|
export declare function mapSidecar(png: string, sidecar: SnapshotSidecar): Omit<ManifestEntry, 'image'>;
|
|
81
|
+
/** How an xcodebuild run ended. */
|
|
82
|
+
export interface XcodebuildRun {
|
|
83
|
+
exitCode: number | null;
|
|
84
|
+
/** Container of each preview test the runner reported failed, one per test. */
|
|
85
|
+
failedPreviews: string[];
|
|
86
|
+
/** Known failure signatures found in the output; empty on success. */
|
|
87
|
+
diagnosis: string[];
|
|
88
|
+
}
|
|
41
89
|
/**
|
|
42
90
|
* Runs xcodebuild. When `quiet` is false (the CLI default), output streams
|
|
43
91
|
* straight to this process's stdout/stderr as it arrives (so a human can
|
|
@@ -47,9 +95,10 @@ export declare function mapSidecar(png: string, sidecar: SnapshotSidecar): Omit<
|
|
|
47
95
|
* tail is kept and nothing is echoed live; the tail is written to stderr once
|
|
48
96
|
* if the build fails.
|
|
49
97
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
98
|
+
* Resolves however the run ends, and rejects only when xcodebuild cannot be
|
|
99
|
+
* started: a failed run can still have rendered previews, and that is for the
|
|
100
|
+
* caller to judge. Failed preview tests are read from the whole stream rather
|
|
101
|
+
* than the tail, and line by line, since a chunk can end mid-line.
|
|
53
102
|
*/
|
|
54
|
-
export declare function runXcodebuild(cwd: string, args: string[], env: Record<string, string>, quiet: boolean): Promise<
|
|
103
|
+
export declare function runXcodebuild(cwd: string, args: string[], env: Record<string, string>, quiet: boolean): Promise<XcodebuildRun>;
|
|
55
104
|
export {};
|
package/dist/engines/ios.js
CHANGED
|
@@ -2,18 +2,47 @@ import { spawn } from 'node:child_process';
|
|
|
2
2
|
import { createHash } from 'node:crypto';
|
|
3
3
|
import { copyFile, mkdir, mkdtemp, readdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
4
4
|
import { tmpdir } from 'node:os';
|
|
5
|
-
import { join, resolve } from 'node:path';
|
|
5
|
+
import { basename, join, resolve } from 'node:path';
|
|
6
6
|
import { diagnoseXcodebuildFailure } from '../errors.js';
|
|
7
7
|
import { SCHEMA_VERSION } from '../manifest.js';
|
|
8
|
+
import { readPngSize } from '../png.js';
|
|
8
9
|
import { parsePreviewName, spaceCamelCase } from '../naming.js';
|
|
9
10
|
import { gitInfo } from './git.js';
|
|
10
|
-
import { findSnapshotTestSubclass, findSnapshottingTestsTargets, readPbxprojText } from '../ios/snapshotTestClass.js';
|
|
11
|
+
import { findSnapshotTestSubclass, findSnapshottingTestsTargets, moduleForFile, readPbxprojText } from '../ios/snapshotTestClass.js';
|
|
12
|
+
import { parseFailedPreviews } from '../ios/unrendered.js';
|
|
13
|
+
import { changedFiles } from '../scan/scope.js';
|
|
11
14
|
/** Builds the error/warning text for a `generate` run that exported zero snapshots. Exported for tests. */
|
|
12
15
|
export function buildEmptySnapshotsMessage(exportDir, scheme) {
|
|
13
16
|
return (`xcodebuild succeeded but no snapshots were exported to ${exportDir}. ` +
|
|
14
17
|
`Does the "${scheme}" scheme include a SnapshotPreviews test target, and are your #Preview macros not all ` +
|
|
15
18
|
'filtered out (e.g. by a snapshotPreviews() override that excludes them)?');
|
|
16
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* A run that rendered some previews and did not finish, usually because a
|
|
22
|
+
* preview crashed. The bundle of what did render has been written.
|
|
23
|
+
*
|
|
24
|
+
* Thrown rather than returned so a caller that only knows the happy path — the
|
|
25
|
+
* CLI — still exits non-zero, while one that can use the partial result catches
|
|
26
|
+
* it. The crash list is worth more than a clean failure: every preview that traps
|
|
27
|
+
* costs a host-app relaunch, so it is what makes the next run shorter.
|
|
28
|
+
*/
|
|
29
|
+
export class IncompleteRenderError extends Error {
|
|
30
|
+
manifest;
|
|
31
|
+
outputDir;
|
|
32
|
+
failedPreviews;
|
|
33
|
+
diagnosis;
|
|
34
|
+
constructor(manifest, outputDir,
|
|
35
|
+
/** Container of each preview test the runner reported failed, one per test. */
|
|
36
|
+
failedPreviews, diagnosis) {
|
|
37
|
+
const crashed = failedPreviews.length > 0 ? `; ${failedPreviews.length} crashed (${[...new Set(failedPreviews)].join(', ')})` : '';
|
|
38
|
+
super([`Rendered ${manifest.entries.length} previews into ${outputDir}, but the run did not finish${crashed}.`, ...diagnosis].join('\n'));
|
|
39
|
+
this.manifest = manifest;
|
|
40
|
+
this.outputDir = outputDir;
|
|
41
|
+
this.failedPreviews = failedPreviews;
|
|
42
|
+
this.diagnosis = diagnosis;
|
|
43
|
+
this.name = 'IncompleteRenderError';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
17
46
|
/**
|
|
18
47
|
* Resolves the -only-testing:Target/Class argument so `generate` runs just the
|
|
19
48
|
* snapshot test class instead of the app's whole test suite — an unrelated
|
|
@@ -41,6 +70,48 @@ export async function resolveOnlyTesting(config, projectDir) {
|
|
|
41
70
|
return undefined;
|
|
42
71
|
}
|
|
43
72
|
}
|
|
73
|
+
/** Escapes a literal so it matches itself inside a regular expression. Exported for tests. */
|
|
74
|
+
export function escapeRegex(literal) {
|
|
75
|
+
return literal.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The SNAPSHOTS_ONLY_FILTER value that renders only the previews declared in
|
|
79
|
+
* `files`, or undefined to render everything.
|
|
80
|
+
*
|
|
81
|
+
* SnapshotPreviews filters before it creates a test method, so a pattern that
|
|
82
|
+
* misses is a preview that never renders — which makes a half-resolved filter
|
|
83
|
+
* worse than none. A file whose module cannot be read (a project that is not
|
|
84
|
+
* using Xcode's synchronized folders, a target xcodebuild will not describe)
|
|
85
|
+
* therefore drops the whole filter rather than quietly dropping that file.
|
|
86
|
+
*
|
|
87
|
+
* Each pattern is anchored against the preview's synthesized fileID,
|
|
88
|
+
* "<Module>/<File>.swift", because the match is a substring search: unanchored,
|
|
89
|
+
* "Card.swift" would also claim UserCard.swift.
|
|
90
|
+
*/
|
|
91
|
+
export async function buildSnapshotsOnlyFilter(files, moduleOf) {
|
|
92
|
+
const swift = files.filter((file) => file.endsWith('.swift'));
|
|
93
|
+
if (swift.length === 0) {
|
|
94
|
+
console.warn('warning: no changed Swift files to narrow to; rendering every preview.');
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
const patterns = [];
|
|
98
|
+
const unresolved = [];
|
|
99
|
+
for (const file of swift) {
|
|
100
|
+
const module = await moduleOf(file);
|
|
101
|
+
if (!module) {
|
|
102
|
+
unresolved.push(file);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
patterns.push(`^${escapeRegex(module)}/${escapeRegex(basename(file))}$`);
|
|
106
|
+
}
|
|
107
|
+
if (unresolved.length > 0) {
|
|
108
|
+
console.warn(`warning: could not resolve the Swift module for ${unresolved.join(', ')} — ` +
|
|
109
|
+
'no filesystem-synchronized folder in the Xcode project covers it, or xcodebuild would not report its ' +
|
|
110
|
+
'build settings. Rendering every preview instead.');
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
return patterns.join('\n');
|
|
114
|
+
}
|
|
44
115
|
/**
|
|
45
116
|
* Runs the SnapshotPreviews-backed XCTest target via xcodebuild on a simulator
|
|
46
117
|
* and harvests the exported PNG + JSON sidecar pairs into a Phonebook bundle.
|
|
@@ -70,14 +141,22 @@ export async function generateIos(config, projectDir, outputDir, options = {}) {
|
|
|
70
141
|
const onlyTesting = await resolveOnlyTesting(config, projectDir);
|
|
71
142
|
if (onlyTesting)
|
|
72
143
|
args.push(`-only-testing:${onlyTesting}`);
|
|
73
|
-
await
|
|
144
|
+
const onlyFilter = await resolveSnapshotsOnlyFilter(config, projectDir, options);
|
|
145
|
+
const run = await runXcodebuild(projectDir, args, {
|
|
74
146
|
TEST_RUNNER_SNAPSHOTS_EXPORT_DIR: exportDir,
|
|
75
147
|
TEST_RUNNER_SNAPSHOTS_RUNNING_FOR_PREVIEWS: '1',
|
|
148
|
+
...(onlyFilter ? { TEST_RUNNER_SNAPSHOTS_ONLY_FILTER: onlyFilter } : {}),
|
|
76
149
|
}, options.quiet ?? false);
|
|
150
|
+
const finished = run.exitCode === 0;
|
|
151
|
+
// Read before deciding anything: a run that failed may still have rendered
|
|
152
|
+
// most of the gallery, and the export directory is deleted on the way out.
|
|
153
|
+
const pngs = (await readdir(exportDir)).filter((f) => f.endsWith('.png')).sort();
|
|
154
|
+
if (!finished && pngs.length === 0 && run.failedPreviews.length === 0) {
|
|
155
|
+
throw new Error([`xcodebuild failed (exit ${run.exitCode}) running: xcodebuild ${args.join(' ')}`, ...run.diagnosis].join('\n'));
|
|
156
|
+
}
|
|
77
157
|
const imagesDir = join(outputDir, 'images');
|
|
78
158
|
await mkdir(imagesDir, { recursive: true });
|
|
79
|
-
|
|
80
|
-
if (pngs.length === 0) {
|
|
159
|
+
if (finished && pngs.length === 0) {
|
|
81
160
|
const message = buildEmptySnapshotsMessage(exportDir, ios.scheme);
|
|
82
161
|
if (!(options.allowEmpty ?? false)) {
|
|
83
162
|
throw new Error(message);
|
|
@@ -92,7 +171,8 @@ export async function generateIos(config, projectDir, outputDir, options = {}) {
|
|
|
92
171
|
hash.update(png);
|
|
93
172
|
const imageName = `${hash.digest('hex').slice(0, 16)}.png`;
|
|
94
173
|
await copyFile(join(exportDir, png), join(imagesDir, imageName));
|
|
95
|
-
|
|
174
|
+
const size = await readPngSize(join(imagesDir, imageName));
|
|
175
|
+
entries.push({ ...meta, image: `images/${imageName}`, ...(size ?? {}) });
|
|
96
176
|
}
|
|
97
177
|
entries.sort((a, b) => a.component.localeCompare(b.component) || a.state.localeCompare(b.state));
|
|
98
178
|
const manifest = {
|
|
@@ -106,12 +186,28 @@ export async function generateIos(config, projectDir, outputDir, options = {}) {
|
|
|
106
186
|
entries,
|
|
107
187
|
};
|
|
108
188
|
await writeFile(join(outputDir, 'manifest.json'), JSON.stringify(manifest, null, 2));
|
|
189
|
+
if (!finished) {
|
|
190
|
+
throw new IncompleteRenderError(manifest, outputDir, run.failedPreviews, run.diagnosis);
|
|
191
|
+
}
|
|
109
192
|
return manifest;
|
|
110
193
|
}
|
|
111
194
|
finally {
|
|
112
195
|
await rm(exportDir, { recursive: true, force: true });
|
|
113
196
|
}
|
|
114
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Turns the `--changed`/`--files` options into a SNAPSHOTS_ONLY_FILTER value,
|
|
200
|
+
* reading the pbxproj once and resolving each file's module through it.
|
|
201
|
+
*/
|
|
202
|
+
async function resolveSnapshotsOnlyFilter(config, projectDir, options) {
|
|
203
|
+
if (!options.changedOnly && !options.files)
|
|
204
|
+
return undefined;
|
|
205
|
+
const ios = config.ios;
|
|
206
|
+
const files = options.files ?? (await changedFiles(projectDir));
|
|
207
|
+
const pbxproj = await readPbxprojText(projectDir, ios.project ? join(projectDir, ios.project) : undefined);
|
|
208
|
+
const cache = new Map();
|
|
209
|
+
return buildSnapshotsOnlyFilter(files, (file) => moduleForFile(pbxproj, projectDir, file, { project: ios.project, workspace: ios.workspace, scheme: ios.scheme }, cache));
|
|
210
|
+
}
|
|
115
211
|
async function readSidecar(path) {
|
|
116
212
|
try {
|
|
117
213
|
return JSON.parse(await readFile(path, 'utf8'));
|
|
@@ -120,6 +216,23 @@ async function readSidecar(path) {
|
|
|
120
216
|
return {};
|
|
121
217
|
}
|
|
122
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* A stable, unique identifier for this preview within the project.
|
|
221
|
+
*
|
|
222
|
+
* Android has a fully qualified name to hand. iOS has nothing equivalent: the
|
|
223
|
+
* sidecar's `display_name` is a label, it usually repeats what `component` and
|
|
224
|
+
* `state` already say, and for an unnamed preview Xcode substitutes the
|
|
225
|
+
* placeholder "At line #14" — not a name, and identical for every unnamed
|
|
226
|
+
* preview in every other file. Qualifying whatever the sidecar gives with the
|
|
227
|
+
* source file makes the result unique across the project and stable between
|
|
228
|
+
* runs; it changes when the preview is renamed or moved, which is when its
|
|
229
|
+
* identity genuinely changed.
|
|
230
|
+
*/
|
|
231
|
+
function previewIdentity(png, sidecar) {
|
|
232
|
+
const label = sidecar.display_name?.trim() || png.replace(/\.png$/, '');
|
|
233
|
+
const group = sidecar.group?.trim();
|
|
234
|
+
return group ? `${group}:${label}` : label;
|
|
235
|
+
}
|
|
123
236
|
/** Exported for tests. Maps one PNG + sidecar to a manifest entry (minus image path). */
|
|
124
237
|
export function mapSidecar(png, sidecar) {
|
|
125
238
|
const container = sidecar.context?.preview?.container_display_name;
|
|
@@ -136,7 +249,7 @@ export function mapSidecar(png, sidecar) {
|
|
|
136
249
|
state,
|
|
137
250
|
module: module ?? 'app',
|
|
138
251
|
sourceFile: group,
|
|
139
|
-
previewName:
|
|
252
|
+
previewName: previewIdentity(png, sidecar),
|
|
140
253
|
theme: scheme === 'dark' ? 'dark' : scheme === 'light' ? 'light' : undefined,
|
|
141
254
|
device: sidecar.context?.simulator?.device_name,
|
|
142
255
|
};
|
|
@@ -150,9 +263,10 @@ export function mapSidecar(png, sidecar) {
|
|
|
150
263
|
* tail is kept and nothing is echoed live; the tail is written to stderr once
|
|
151
264
|
* if the build fails.
|
|
152
265
|
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
266
|
+
* Resolves however the run ends, and rejects only when xcodebuild cannot be
|
|
267
|
+
* started: a failed run can still have rendered previews, and that is for the
|
|
268
|
+
* caller to judge. Failed preview tests are read from the whole stream rather
|
|
269
|
+
* than the tail, and line by line, since a chunk can end mid-line.
|
|
156
270
|
*/
|
|
157
271
|
export function runXcodebuild(cwd, args, env, quiet) {
|
|
158
272
|
return new Promise((resolvePromise, reject) => {
|
|
@@ -162,33 +276,34 @@ export function runXcodebuild(cwd, args, env, quiet) {
|
|
|
162
276
|
env: { ...process.env, ...env },
|
|
163
277
|
});
|
|
164
278
|
let tail = [];
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
279
|
+
const failedPreviews = [];
|
|
280
|
+
const partial = { stdout: '', stderr: '' };
|
|
281
|
+
const takeLines = (lines) => {
|
|
282
|
+
failedPreviews.push(...parseFailedPreviews(lines.join('\n')));
|
|
283
|
+
tail.push(...lines);
|
|
169
284
|
if (tail.length > 200)
|
|
170
285
|
tail = tail.slice(-200);
|
|
171
286
|
};
|
|
172
|
-
|
|
173
|
-
|
|
287
|
+
const onData = (stream, target) => (data) => {
|
|
288
|
+
if (!quiet)
|
|
289
|
+
target.write(data);
|
|
290
|
+
const lines = (partial[stream] + data.toString('utf8')).split('\n');
|
|
291
|
+
partial[stream] = lines.pop() ?? '';
|
|
292
|
+
takeLines(lines);
|
|
293
|
+
};
|
|
294
|
+
child.stdout?.on('data', onData('stdout', process.stdout));
|
|
295
|
+
child.stderr?.on('data', onData('stderr', process.stderr));
|
|
174
296
|
child.on('error', reject);
|
|
175
297
|
child.on('close', (code) => {
|
|
176
|
-
|
|
177
|
-
resolvePromise();
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
298
|
+
takeLines([partial.stdout, partial.stderr].filter((l) => l.length > 0));
|
|
180
299
|
const tailText = tail.join('\n');
|
|
181
|
-
const diagnosis = diagnoseXcodebuildFailure(tailText);
|
|
300
|
+
const diagnosis = code === 0 ? [] : diagnoseXcodebuildFailure(tailText);
|
|
182
301
|
if (diagnosis.length > 0) {
|
|
183
302
|
process.stderr.write(diagnosis.map((line) => `phonebook: ${line}`).join('\n') + '\n');
|
|
184
303
|
}
|
|
185
|
-
if (quiet && tail.length > 0)
|
|
304
|
+
if (quiet && code !== 0 && tail.length > 0)
|
|
186
305
|
process.stderr.write(tailText + '\n');
|
|
187
|
-
|
|
188
|
-
`xcodebuild failed (exit ${code}) running: xcodebuild ${args.join(' ')}`,
|
|
189
|
-
...diagnosis,
|
|
190
|
-
].join('\n');
|
|
191
|
-
reject(new Error(message));
|
|
306
|
+
resolvePromise({ exitCode: code, failedPreviews, diagnosis });
|
|
192
307
|
});
|
|
193
308
|
});
|
|
194
309
|
}
|
package/dist/engines/ios.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ios.js","sourceRoot":"","sources":["../../src/engines/ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UA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AC,CAAC;AACL,CAAC"}
|
package/dist/errors.js
CHANGED
|
@@ -50,12 +50,23 @@ export function diagnoseXcodebuildFailure(output) {
|
|
|
50
50
|
lines.push("The SnapshotTest base class lives in the SnapshottingTests module — the snapshot test file should say " +
|
|
51
51
|
'`import SnapshottingTests`. Otherwise, add the missing package product to the test target in Xcode.');
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
// The runtime also dies with -308 after previews have been trapping for a
|
|
54
|
+
// while. Then the previews are the cause, and resetting the simulator
|
|
55
|
+
// mid-run only destroys the device the run is using.
|
|
56
|
+
const previewsFailed = /Test case '[^']+' failed/.test(output);
|
|
57
|
+
if (!previewsFailed &&
|
|
58
|
+
/Failed to install or launch the test runner|Mach error -308|\(ipc\/mig\) server died/.test(output)) {
|
|
54
59
|
lines.push('The iOS simulator runtime died while installing the test runner — usually transient, not a setup problem.');
|
|
55
60
|
lines.push('Retry once; if it persists run: xcrun simctl shutdown all (and if still failing: xcrun simctl erase ' +
|
|
56
61
|
'"<device name>"). First boot of a newly installed runtime can also take minutes — let it finish in ' +
|
|
57
62
|
'Simulator.app before retrying.');
|
|
58
63
|
}
|
|
64
|
+
if (/never finished bootstrapping|before establishing connection/.test(output)) {
|
|
65
|
+
lines.push('The app hosting the previews was stopped before the test runner connected to it, so no preview ran: it ' +
|
|
66
|
+
'hung or crashed while launching.');
|
|
67
|
+
lines.push('If the same app launched in an earlier run, the simulator is the difference, not the app: retry once. ' +
|
|
68
|
+
'If it fails again, the app\'s own launch is what to look at, before any preview.');
|
|
69
|
+
}
|
|
59
70
|
if (/Scheme (.+?) is not currently configured for the test action|does not contain any tests|There are no test bundles/.test(output)) {
|
|
60
71
|
lines.push("The scheme's Test action has no runnable tests. Ensure the test target with your SnapshotTest subclass " +
|
|
61
72
|
'is included in the scheme\'s Test action, then run `phonebook doctor`.');
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src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I,CACR,wGAAwG;YACtG,kFAAkF,CACrF,CAAC;IACJ,CAAC;IAED,IACE,mHAAmH,CAAC,IAAI,CACtH,MAAM,CACP,EACD,CAAC;QACD,KAAK,CAAC,IAAI,CACR,yGAAyG;YACvG,wEAAwE,CAC3E,CAAC;IACJ,CAAC;IAED,IAAI,iDAAiD,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACnE,KAAK,CAAC,IAAI,CACR,qGAAqG;YACnG,qDAAqD,CACxD,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -57,3 +57,47 @@ export interface SnapshotTestClassLocation {
|
|
|
57
57
|
* undefined if the target can't be identified or parsing fails.
|
|
58
58
|
*/
|
|
59
59
|
export declare function findSnapshotTestClassLocation(pbxproj: string): SnapshotTestClassLocation | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* A folder covered by a PBXFileSystemSynchronizedRootGroup, and the target that
|
|
62
|
+
* owns it. Xcode 16+ projects assign whole folders to a target this way, so a
|
|
63
|
+
* source file's target — and therefore its Swift module — can be read off the
|
|
64
|
+
* pbxproj without any per-file build-phase membership.
|
|
65
|
+
*
|
|
66
|
+
* Classic PBXGroup/PBXSourcesBuildPhase projects have no such folder mapping and
|
|
67
|
+
* are deliberately out of scope: they resolve to no owner at all, and callers
|
|
68
|
+
* fall back to rendering everything.
|
|
69
|
+
*/
|
|
70
|
+
export interface SynchronizedGroupOwner {
|
|
71
|
+
targetName: string;
|
|
72
|
+
/** Folder path, relative to the project directory, "/"-joined and unquoted. */
|
|
73
|
+
path: string;
|
|
74
|
+
/** Paths (relative to the project directory) explicitly excluded from this target. */
|
|
75
|
+
exclusions: Set<string>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Every filesystem-synchronized folder in the project, with the target it
|
|
79
|
+
* belongs to and the files explicitly excepted from that target.
|
|
80
|
+
*/
|
|
81
|
+
export declare function synchronizedGroupOwners(pbxproj: string): SynchronizedGroupOwner[];
|
|
82
|
+
/**
|
|
83
|
+
* The target that compiles `filePath`, via the synchronized folder that covers
|
|
84
|
+
* it. The longest covering folder wins, so a nested folder assigned to its own
|
|
85
|
+
* target beats the parent that contains it; a file explicitly excepted from a
|
|
86
|
+
* folder's target falls through to the next-longest candidate.
|
|
87
|
+
*/
|
|
88
|
+
export declare function targetForFile(pbxproj: string, filePath: string): string | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* The Swift module name a source file compiles into, or undefined when the
|
|
91
|
+
* project structure cannot say (no synchronized folder covers it, or xcodebuild
|
|
92
|
+
* cannot report the target's settings).
|
|
93
|
+
*
|
|
94
|
+
* The module name is the first half of a #Preview's synthesized fileID
|
|
95
|
+
* ("<Module>/<File>.swift"), which is what SnapshotPreviews matches its filter
|
|
96
|
+
* patterns against. `cache` is keyed by target name so a run that filters a
|
|
97
|
+
* dozen files still shells out to xcodebuild once per target.
|
|
98
|
+
*/
|
|
99
|
+
export declare function moduleForFile(pbxproj: string, projectDir: string, filePath: string, xcodebuildTarget: {
|
|
100
|
+
project?: string;
|
|
101
|
+
workspace?: string;
|
|
102
|
+
scheme?: string;
|
|
103
|
+
}, cache?: Map<string, string | undefined>): Promise<string | undefined>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
1
2
|
import { readdir, readFile } from 'node:fs/promises';
|
|
2
3
|
import { join, relative } from 'node:path';
|
|
4
|
+
import { promisify } from 'node:util';
|
|
5
|
+
const run = promisify(execFile);
|
|
3
6
|
/**
|
|
4
7
|
* Shared iOS SnapshotTest-subclass discovery: scanning project sources for an
|
|
5
8
|
* existing subclass, and (heuristically) parsing a .pbxproj to find which
|
|
@@ -192,4 +195,116 @@ export function findSnapshotTestClassLocation(pbxproj) {
|
|
|
192
195
|
return undefined;
|
|
193
196
|
}
|
|
194
197
|
}
|
|
198
|
+
function parseListItems(body, key) {
|
|
199
|
+
const match = body.match(new RegExp(`${key} = \\(([\\s\\S]*?)\\);`));
|
|
200
|
+
if (!match)
|
|
201
|
+
return [];
|
|
202
|
+
return match[1]
|
|
203
|
+
.split(',')
|
|
204
|
+
.map((item) => unquote(item.replace(/\/\*[\s\S]*?\*\//g, '').trim()))
|
|
205
|
+
.filter((item) => item.length > 0);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Every filesystem-synchronized folder in the project, with the target it
|
|
209
|
+
* belongs to and the files explicitly excepted from that target.
|
|
210
|
+
*/
|
|
211
|
+
export function synchronizedGroupOwners(pbxproj) {
|
|
212
|
+
const targets = extractPbxprojObjects(pbxproj, 'PBXNativeTarget');
|
|
213
|
+
const syncGroups = extractPbxprojObjects(pbxproj, 'PBXFileSystemSynchronizedRootGroup');
|
|
214
|
+
const exceptionSets = extractPbxprojObjects(pbxproj, 'PBXFileSystemSynchronizedBuildFileExceptionSet');
|
|
215
|
+
const owners = [];
|
|
216
|
+
for (const [targetId, targetBody] of targets) {
|
|
217
|
+
const nameMatch = targetBody.match(/\n\t\t\tname = ([^\n;]+);/);
|
|
218
|
+
const targetName = nameMatch ? unquote(nameMatch[1]) : targetId;
|
|
219
|
+
const groupsMatch = targetBody.match(/fileSystemSynchronizedGroups = \(([\s\S]*?)\)/);
|
|
220
|
+
if (!groupsMatch)
|
|
221
|
+
continue;
|
|
222
|
+
for (const gid of [...groupsMatch[1].matchAll(/([0-9A-F]{24})/g)].map((m) => m[1])) {
|
|
223
|
+
const groupBody = syncGroups.get(gid);
|
|
224
|
+
if (!groupBody)
|
|
225
|
+
continue;
|
|
226
|
+
const pathMatch = groupBody.match(/\n\t\t\tpath = ([^\n;]+);/);
|
|
227
|
+
if (!pathMatch)
|
|
228
|
+
continue;
|
|
229
|
+
const path = unquote(pathMatch[1]).replace(/\/+$/, '');
|
|
230
|
+
const exclusions = new Set();
|
|
231
|
+
const exceptionIds = [
|
|
232
|
+
...(groupBody.match(/exceptions = \(([\s\S]*?)\)/)?.[1] ?? '').matchAll(/([0-9A-F]{24})/g),
|
|
233
|
+
].map((m) => m[1]);
|
|
234
|
+
for (const eid of exceptionIds) {
|
|
235
|
+
const exceptionBody = exceptionSets.get(eid);
|
|
236
|
+
if (!exceptionBody)
|
|
237
|
+
continue;
|
|
238
|
+
// An exception set belongs to one target; one that names another target
|
|
239
|
+
// says nothing about this folder's membership here.
|
|
240
|
+
const exceptionTarget = exceptionBody.match(/\n\t\t\ttarget = ([0-9A-F]{24})/)?.[1];
|
|
241
|
+
if (exceptionTarget && exceptionTarget !== targetId)
|
|
242
|
+
continue;
|
|
243
|
+
for (const member of parseListItems(exceptionBody, 'membershipExceptions')) {
|
|
244
|
+
exclusions.add(`${path}/${member}`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
owners.push({ targetName, path, exclusions });
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return owners;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* The target that compiles `filePath`, via the synchronized folder that covers
|
|
254
|
+
* it. The longest covering folder wins, so a nested folder assigned to its own
|
|
255
|
+
* target beats the parent that contains it; a file explicitly excepted from a
|
|
256
|
+
* folder's target falls through to the next-longest candidate.
|
|
257
|
+
*/
|
|
258
|
+
export function targetForFile(pbxproj, filePath) {
|
|
259
|
+
const normalized = filePath.replace(/^\.\//, '');
|
|
260
|
+
const candidates = synchronizedGroupOwners(pbxproj)
|
|
261
|
+
.filter((owner) => normalized === owner.path || normalized.startsWith(`${owner.path}/`))
|
|
262
|
+
.sort((a, b) => b.path.length - a.path.length);
|
|
263
|
+
for (const candidate of candidates) {
|
|
264
|
+
if (candidate.exclusions.has(normalized))
|
|
265
|
+
continue;
|
|
266
|
+
return candidate.targetName;
|
|
267
|
+
}
|
|
268
|
+
return undefined;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* The Swift module name a source file compiles into, or undefined when the
|
|
272
|
+
* project structure cannot say (no synchronized folder covers it, or xcodebuild
|
|
273
|
+
* cannot report the target's settings).
|
|
274
|
+
*
|
|
275
|
+
* The module name is the first half of a #Preview's synthesized fileID
|
|
276
|
+
* ("<Module>/<File>.swift"), which is what SnapshotPreviews matches its filter
|
|
277
|
+
* patterns against. `cache` is keyed by target name so a run that filters a
|
|
278
|
+
* dozen files still shells out to xcodebuild once per target.
|
|
279
|
+
*/
|
|
280
|
+
export async function moduleForFile(pbxproj, projectDir, filePath, xcodebuildTarget, cache) {
|
|
281
|
+
const targetName = targetForFile(pbxproj, filePath);
|
|
282
|
+
if (!targetName)
|
|
283
|
+
return undefined;
|
|
284
|
+
if (cache?.has(targetName))
|
|
285
|
+
return cache.get(targetName);
|
|
286
|
+
const module = await productModuleName(projectDir, targetName, xcodebuildTarget);
|
|
287
|
+
cache?.set(targetName, module);
|
|
288
|
+
return module;
|
|
289
|
+
}
|
|
290
|
+
async function productModuleName(projectDir, targetName, xcodebuildTarget) {
|
|
291
|
+
const args = ['-showBuildSettings'];
|
|
292
|
+
if (xcodebuildTarget.workspace) {
|
|
293
|
+
args.push('-workspace', xcodebuildTarget.workspace);
|
|
294
|
+
if (xcodebuildTarget.scheme)
|
|
295
|
+
args.push('-scheme', xcodebuildTarget.scheme);
|
|
296
|
+
}
|
|
297
|
+
else if (xcodebuildTarget.project) {
|
|
298
|
+
args.push('-project', xcodebuildTarget.project);
|
|
299
|
+
}
|
|
300
|
+
args.push('-target', targetName);
|
|
301
|
+
try {
|
|
302
|
+
const { stdout } = await run('xcodebuild', args, { cwd: projectDir, maxBuffer: 32 * 1024 * 1024 });
|
|
303
|
+
const match = stdout.match(/^\s*PRODUCT_MODULE_NAME = (.+)$/m);
|
|
304
|
+
return match ? match[1].trim() : undefined;
|
|
305
|
+
}
|
|
306
|
+
catch {
|
|
307
|
+
return undefined;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
195
310
|
//# sourceMappingURL=snapshotTestClass.js.map
|