@sentry/wizard 6.1.0 → 6.1.2
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/CHANGELOG.md +9 -0
- package/dist/src/angular/angular-wizard.js +1 -1
- package/dist/src/angular/angular-wizard.js.map +1 -1
- package/dist/src/apple/templates.js +17 -2
- package/dist/src/apple/templates.js.map +1 -1
- package/dist/src/apple/xcode-manager.d.ts +18 -0
- package/dist/src/apple/xcode-manager.js +117 -21
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +1 -1
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nuxt/nuxt-wizard.js +1 -1
- package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
- package/dist/src/remix/remix-wizard.js +1 -1
- package/dist/src/remix/remix-wizard.js.map +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/test/apple/templates.test.js +36 -34
- package/dist/test/apple/templates.test.js.map +1 -1
- package/dist/test/apple/xcode-manager.test.js +418 -0
- package/dist/test/apple/xcode-manager.test.js.map +1 -1
- package/package.json +1 -1
|
@@ -10,70 +10,72 @@ const templates_1 = require("../../src/apple/templates");
|
|
|
10
10
|
includeHomebrewPath: true,
|
|
11
11
|
expectedScript: `# This script is responsible for uploading debug symbols and source context for Sentry.
|
|
12
12
|
if [[ "$(uname -m)" == arm64 ]]; then
|
|
13
|
-
export PATH="/opt/homebrew/bin:$PATH"
|
|
13
|
+
export PATH="/opt/homebrew/bin:$PATH"
|
|
14
14
|
fi
|
|
15
|
+
|
|
15
16
|
if which sentry-cli >/dev/null; then
|
|
16
|
-
export SENTRY_ORG=test-org
|
|
17
|
-
export SENTRY_PROJECT=test-project
|
|
18
|
-
ERROR=$(sentry-cli debug-files upload --include-sources "$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)
|
|
19
|
-
if [ ! $? -eq 0 ]; then
|
|
20
|
-
echo "warning: sentry-cli - $ERROR"
|
|
21
|
-
fi
|
|
17
|
+
export SENTRY_ORG=test-org
|
|
18
|
+
export SENTRY_PROJECT=test-project
|
|
19
|
+
ERROR=$(sentry-cli debug-files upload --include-sources "$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)
|
|
20
|
+
if [ ! $? -eq 0 ]; then
|
|
21
|
+
echo "warning: sentry-cli - $ERROR"
|
|
22
|
+
fi
|
|
22
23
|
else
|
|
23
|
-
echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"
|
|
24
|
+
echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"
|
|
24
25
|
fi
|
|
25
|
-
|
|
26
|
+
`,
|
|
26
27
|
},
|
|
27
28
|
{
|
|
28
29
|
uploadSource: true,
|
|
29
30
|
includeHomebrewPath: false,
|
|
30
31
|
expectedScript: `# This script is responsible for uploading debug symbols and source context for Sentry.
|
|
31
32
|
if which sentry-cli >/dev/null; then
|
|
32
|
-
export SENTRY_ORG=test-org
|
|
33
|
-
export SENTRY_PROJECT=test-project
|
|
34
|
-
ERROR=$(sentry-cli debug-files upload --include-sources "$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)
|
|
35
|
-
if [ ! $? -eq 0 ]; then
|
|
36
|
-
echo "warning: sentry-cli - $ERROR"
|
|
37
|
-
fi
|
|
33
|
+
export SENTRY_ORG=test-org
|
|
34
|
+
export SENTRY_PROJECT=test-project
|
|
35
|
+
ERROR=$(sentry-cli debug-files upload --include-sources "$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)
|
|
36
|
+
if [ ! $? -eq 0 ]; then
|
|
37
|
+
echo "warning: sentry-cli - $ERROR"
|
|
38
|
+
fi
|
|
38
39
|
else
|
|
39
|
-
echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"
|
|
40
|
+
echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"
|
|
40
41
|
fi
|
|
41
|
-
|
|
42
|
+
`,
|
|
42
43
|
},
|
|
43
44
|
{
|
|
44
45
|
uploadSource: false,
|
|
45
46
|
includeHomebrewPath: true,
|
|
46
47
|
expectedScript: `# This script is responsible for uploading debug symbols and source context for Sentry.
|
|
47
48
|
if [[ "$(uname -m)" == arm64 ]]; then
|
|
48
|
-
export PATH="/opt/homebrew/bin:$PATH"
|
|
49
|
+
export PATH="/opt/homebrew/bin:$PATH"
|
|
49
50
|
fi
|
|
51
|
+
|
|
50
52
|
if which sentry-cli >/dev/null; then
|
|
51
|
-
export SENTRY_ORG=test-org
|
|
52
|
-
export SENTRY_PROJECT=test-project
|
|
53
|
-
ERROR=$(sentry-cli debug-files upload "$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)
|
|
54
|
-
if [ ! $? -eq 0 ]; then
|
|
55
|
-
echo "warning: sentry-cli - $ERROR"
|
|
56
|
-
fi
|
|
53
|
+
export SENTRY_ORG=test-org
|
|
54
|
+
export SENTRY_PROJECT=test-project
|
|
55
|
+
ERROR=$(sentry-cli debug-files upload "$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)
|
|
56
|
+
if [ ! $? -eq 0 ]; then
|
|
57
|
+
echo "warning: sentry-cli - $ERROR"
|
|
58
|
+
fi
|
|
57
59
|
else
|
|
58
|
-
echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"
|
|
60
|
+
echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"
|
|
59
61
|
fi
|
|
60
|
-
|
|
62
|
+
`,
|
|
61
63
|
},
|
|
62
64
|
{
|
|
63
65
|
uploadSource: false,
|
|
64
66
|
includeHomebrewPath: false,
|
|
65
67
|
expectedScript: `# This script is responsible for uploading debug symbols and source context for Sentry.
|
|
66
68
|
if which sentry-cli >/dev/null; then
|
|
67
|
-
export SENTRY_ORG=test-org
|
|
68
|
-
export SENTRY_PROJECT=test-project
|
|
69
|
-
ERROR=$(sentry-cli debug-files upload "$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)
|
|
70
|
-
if [ ! $? -eq 0 ]; then
|
|
71
|
-
echo "warning: sentry-cli - $ERROR"
|
|
72
|
-
fi
|
|
69
|
+
export SENTRY_ORG=test-org
|
|
70
|
+
export SENTRY_PROJECT=test-project
|
|
71
|
+
ERROR=$(sentry-cli debug-files upload "$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)
|
|
72
|
+
if [ ! $? -eq 0 ]; then
|
|
73
|
+
echo "warning: sentry-cli - $ERROR"
|
|
74
|
+
fi
|
|
73
75
|
else
|
|
74
|
-
echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"
|
|
76
|
+
echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"
|
|
75
77
|
fi
|
|
76
|
-
|
|
78
|
+
`,
|
|
77
79
|
},
|
|
78
80
|
];
|
|
79
81
|
for (const variation of variations) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/apple/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,yDAMmC;AAEnC,IAAA,iBAAQ,EAAC,WAAW,EAAE,GAAG,EAAE;IACzB,IAAA,iBAAQ,EAAC,sBAAsB,EAAE,GAAG,EAAE;QACpC,MAAM,UAAU,GAIV;YACJ;gBACE,YAAY,EAAE,IAAI;gBAClB,mBAAmB,EAAE,IAAI;gBACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/apple/templates.test.ts"],"names":[],"mappings":"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","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n getFastlaneSnippet,\n getObjcSnippet,\n getRunScriptTemplate,\n getSwiftSnippet,\n scriptInputPath,\n} from '../../src/apple/templates';\n\ndescribe('templates', () => {\n describe('getRunScriptTemplate', () => {\n const variations: {\n uploadSource: boolean;\n includeHomebrewPath: boolean;\n expectedScript: string;\n }[] = [\n {\n uploadSource: true,\n includeHomebrewPath: true,\n expectedScript: `# This script is responsible for uploading debug symbols and source context for Sentry.\nif [[ \"$(uname -m)\" == arm64 ]]; then\n export PATH=\"/opt/homebrew/bin:$PATH\"\nfi\n\nif which sentry-cli >/dev/null; then\n export SENTRY_ORG=test-org\n export SENTRY_PROJECT=test-project\n ERROR=$(sentry-cli debug-files upload --include-sources \"$DWARF_DSYM_FOLDER_PATH\" 2>&1 >/dev/null)\n if [ ! $? -eq 0 ]; then\n echo \"warning: sentry-cli - $ERROR\"\n fi\nelse\n echo \"warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases\"\nfi\n`,\n },\n {\n uploadSource: true,\n includeHomebrewPath: false,\n expectedScript: `# This script is responsible for uploading debug symbols and source context for Sentry.\nif which sentry-cli >/dev/null; then\n export SENTRY_ORG=test-org\n export SENTRY_PROJECT=test-project\n ERROR=$(sentry-cli debug-files upload --include-sources \"$DWARF_DSYM_FOLDER_PATH\" 2>&1 >/dev/null)\n if [ ! $? -eq 0 ]; then\n echo \"warning: sentry-cli - $ERROR\"\n fi\nelse\n echo \"warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases\"\nfi\n`,\n },\n {\n uploadSource: false,\n includeHomebrewPath: true,\n expectedScript: `# This script is responsible for uploading debug symbols and source context for Sentry.\nif [[ \"$(uname -m)\" == arm64 ]]; then\n export PATH=\"/opt/homebrew/bin:$PATH\"\nfi\n\nif which sentry-cli >/dev/null; then\n export SENTRY_ORG=test-org\n export SENTRY_PROJECT=test-project\n ERROR=$(sentry-cli debug-files upload \"$DWARF_DSYM_FOLDER_PATH\" 2>&1 >/dev/null)\n if [ ! $? -eq 0 ]; then\n echo \"warning: sentry-cli - $ERROR\"\n fi\nelse\n echo \"warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases\"\nfi\n`,\n },\n {\n uploadSource: false,\n includeHomebrewPath: false,\n expectedScript: `# This script is responsible for uploading debug symbols and source context for Sentry.\nif which sentry-cli >/dev/null; then\n export SENTRY_ORG=test-org\n export SENTRY_PROJECT=test-project\n ERROR=$(sentry-cli debug-files upload \"$DWARF_DSYM_FOLDER_PATH\" 2>&1 >/dev/null)\n if [ ! $? -eq 0 ]; then\n echo \"warning: sentry-cli - $ERROR\"\n fi\nelse\n echo \"warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases\"\nfi\n`,\n },\n ];\n\n for (const variation of variations) {\n describe(`uploadSource: ${variation.uploadSource.toString()} and includeHomebrewPath: ${variation.includeHomebrewPath.toString()}`, () => {\n it('should return the correct script', () => {\n // -- ct --\n const script = getRunScriptTemplate(\n 'test-org',\n 'test-project',\n variation.uploadSource,\n variation.includeHomebrewPath,\n );\n\n // -- Assert --\n expect(script).toBe(variation.expectedScript);\n });\n });\n }\n });\n\n describe('scriptInputPath', () => {\n it('should return the correct path', () => {\n expect(scriptInputPath).toBe(\n '\"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}\"',\n );\n });\n });\n\n describe('getSwiftSnippet', () => {\n it('should return the correct snippet', () => {\n // -- Arrange --\n const snippet = getSwiftSnippet('test-dsn');\n\n // -- Assert --\n expect(snippet).toBe(\n ` SentrySDK.start { options in\n options.dsn = \"test-dsn\"\n options.debug = true // Enabled debug when first installing is always helpful\n\n // Adds IP for users.\n // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/\n options.sendDefaultPii = true\n\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0\n\n // Configure profiling. Visit https://docs.sentry.io/platforms/apple/profiling/ to learn more.\n options.configureProfiling = {\n $0.sessionSampleRate = 1.0 // We recommend adjusting this value in production.\n $0.lifecycle = .trace\n }\n\n // Uncomment the following lines to add more data to your events\n // options.attachScreenshot = true // This adds a screenshot to the error events\n // options.attachViewHierarchy = true // This adds the view hierarchy to the error events\n }\n // Remove the next line after confirming that your Sentry integration is working.\n SentrySDK.capture(message: \"This app uses Sentry! :)\")\n`,\n );\n });\n });\n\n describe('getObjcSnippet', () => {\n it('should return the correct snippet', () => {\n // -- Arrange --\n const snippet = getObjcSnippet('test-dsn');\n\n // -- Assert --\n expect(snippet).toBe(\n ` [SentrySDK startWithConfigureOptions:^(SentryOptions * options) {\n options.dsn = @\"test-dsn\";\n options.debug = YES; // Enabled debug when first installing is always helpful\n\n // Adds IP for users.\n // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/\n options.sendDefaultPii = YES;\n\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = @1.0;\n\n // Configure profiling. Visit https://docs.sentry.io/platforms/apple/profiling/ to learn more.\n options.configureProfiling = ^(SentryProfileOptions *profiling) {\n profiling.sessionSampleRate = 1.0; // We recommend adjusting this value in production.\n profiling.lifecycle = SentryProfilingLifecycleTrace;\n };\n\n //Uncomment the following lines to add more data to your events\n //options.attachScreenshot = YES; //This will add a screenshot to the error events\n //options.attachViewHierarchy = YES; //This will add the view hierarchy to the error events\n }];\n //Remove the next line after confirming that your Sentry integration is working.\n [SentrySDK captureMessage:@\"This app uses Sentry!\"];\n`,\n );\n });\n });\n\n describe('getFastlaneSnippet', () => {\n it('should return the correct snippet', () => {\n // -- Arrange --\n const snippet = getFastlaneSnippet('test-org', 'test-project');\n\n // -- Assert --\n expect(snippet).toBe(\n ` sentry_cli(\n org_slug: 'test-org',\n project_slug: 'test-project',\n include_sources: true\n )`,\n );\n });\n });\n});\n"]}
|
|
@@ -396,6 +396,27 @@ const projectData = {
|
|
|
396
396
|
productName: 'Sentry',
|
|
397
397
|
});
|
|
398
398
|
});
|
|
399
|
+
(0, vitest_1.it)('should initialize packageProductDependencies if not present', () => {
|
|
400
|
+
// -- Arrange --
|
|
401
|
+
// Ensure the target exists but has no packageProductDependencies initially
|
|
402
|
+
const targetKey = 'D4E604CC2D50CEEC00CAB00F';
|
|
403
|
+
const target = xcodeProject.objects.PBXNativeTarget?.[targetKey];
|
|
404
|
+
if (target) {
|
|
405
|
+
// Remove packageProductDependencies to test initialization
|
|
406
|
+
delete target.packageProductDependencies;
|
|
407
|
+
}
|
|
408
|
+
// -- Act --
|
|
409
|
+
xcodeProject.updateXcodeProject(projectData, 'Project', addSPMReference);
|
|
410
|
+
// -- Assert --
|
|
411
|
+
const updatedTarget = xcodeProject.objects.PBXNativeTarget?.[targetKey];
|
|
412
|
+
(0, vitest_1.expect)(updatedTarget.packageProductDependencies).toBeDefined();
|
|
413
|
+
(0, vitest_1.expect)(updatedTarget.packageProductDependencies).toEqual([
|
|
414
|
+
vitest_1.expect.objectContaining({
|
|
415
|
+
value: vitest_1.expect.any(String),
|
|
416
|
+
comment: 'Sentry',
|
|
417
|
+
}),
|
|
418
|
+
]);
|
|
419
|
+
});
|
|
399
420
|
});
|
|
400
421
|
});
|
|
401
422
|
(0, vitest_1.describe)('getSourceFilesForTarget', () => {
|
|
@@ -1213,6 +1234,403 @@ const projectData = {
|
|
|
1213
1234
|
});
|
|
1214
1235
|
});
|
|
1215
1236
|
});
|
|
1237
|
+
(0, vitest_1.describe)('addUploadSymbolsScript', () => {
|
|
1238
|
+
let sourceProjectPath;
|
|
1239
|
+
let tempProjectPath;
|
|
1240
|
+
let xcodeProject;
|
|
1241
|
+
(0, vitest_1.beforeEach)(() => {
|
|
1242
|
+
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'add-upload-symbols-script'));
|
|
1243
|
+
sourceProjectPath = singleTargetProjectPath;
|
|
1244
|
+
tempProjectPath = path.resolve(tempDir, 'project.pbxproj');
|
|
1245
|
+
fs.copyFileSync(sourceProjectPath, tempProjectPath);
|
|
1246
|
+
xcodeProject = new xcode_manager_1.XcodeProject(tempProjectPath);
|
|
1247
|
+
});
|
|
1248
|
+
(0, vitest_1.describe)('when target is not found', () => {
|
|
1249
|
+
(0, vitest_1.it)('should return early', () => {
|
|
1250
|
+
// -- Act --
|
|
1251
|
+
xcodeProject.addUploadSymbolsScript({
|
|
1252
|
+
sentryProject: projectData,
|
|
1253
|
+
targetName: 'NonExistentTarget',
|
|
1254
|
+
uploadSource: true,
|
|
1255
|
+
});
|
|
1256
|
+
// -- Assert --
|
|
1257
|
+
// Verify that no shell script build phases were added
|
|
1258
|
+
(0, vitest_1.expect)(xcodeProject.objects.PBXShellScriptBuildPhase).toBeUndefined();
|
|
1259
|
+
});
|
|
1260
|
+
});
|
|
1261
|
+
(0, vitest_1.describe)('when target has existing Sentry build phase', () => {
|
|
1262
|
+
(0, vitest_1.beforeEach)(() => {
|
|
1263
|
+
// Set up a target with an existing Sentry build phase
|
|
1264
|
+
xcodeProject.objects.PBXNativeTarget = {
|
|
1265
|
+
'target-key': {
|
|
1266
|
+
isa: 'PBXNativeTarget',
|
|
1267
|
+
name: 'TestTarget',
|
|
1268
|
+
buildPhases: [
|
|
1269
|
+
{
|
|
1270
|
+
value: 'existing-sentry-phase',
|
|
1271
|
+
comment: 'Upload Debug Symbols to Sentry',
|
|
1272
|
+
},
|
|
1273
|
+
],
|
|
1274
|
+
},
|
|
1275
|
+
};
|
|
1276
|
+
xcodeProject.objects.PBXShellScriptBuildPhase = {
|
|
1277
|
+
'existing-sentry-phase': {
|
|
1278
|
+
isa: 'PBXShellScriptBuildPhase',
|
|
1279
|
+
shellScript: '"echo sentry-cli upload-dsym"',
|
|
1280
|
+
buildActionMask: 2147483647,
|
|
1281
|
+
files: [],
|
|
1282
|
+
inputPaths: [],
|
|
1283
|
+
outputPaths: [],
|
|
1284
|
+
runOnlyForDeploymentPostprocessing: 0,
|
|
1285
|
+
shellPath: '/bin/sh',
|
|
1286
|
+
},
|
|
1287
|
+
};
|
|
1288
|
+
});
|
|
1289
|
+
(0, vitest_1.it)('should update existing build phase instead of adding new one', () => {
|
|
1290
|
+
// -- Act --
|
|
1291
|
+
xcodeProject.addUploadSymbolsScript({
|
|
1292
|
+
sentryProject: projectData,
|
|
1293
|
+
targetName: 'TestTarget',
|
|
1294
|
+
uploadSource: true,
|
|
1295
|
+
});
|
|
1296
|
+
// -- Assert --
|
|
1297
|
+
// Should still have only one build phase (the updated one)
|
|
1298
|
+
const buildPhases = Object.keys(xcodeProject.objects.PBXShellScriptBuildPhase || {});
|
|
1299
|
+
(0, vitest_1.expect)(buildPhases.filter((key) => !key.endsWith('_comment'))).toHaveLength(1);
|
|
1300
|
+
// The existing phase should be updated with new script content
|
|
1301
|
+
const updatedPhase = xcodeProject.objects.PBXShellScriptBuildPhase?.['existing-sentry-phase'];
|
|
1302
|
+
(0, vitest_1.expect)(updatedPhase).toBeDefined();
|
|
1303
|
+
(0, vitest_1.expect)(updatedPhase?.shellScript).toContain('sentry-cli');
|
|
1304
|
+
});
|
|
1305
|
+
});
|
|
1306
|
+
(0, vitest_1.describe)('orphaned build phase cleanup', () => {
|
|
1307
|
+
(0, vitest_1.beforeEach)(() => {
|
|
1308
|
+
// Set up targets with orphaned build phase references
|
|
1309
|
+
xcodeProject.objects.PBXNativeTarget = {
|
|
1310
|
+
'target-1': {
|
|
1311
|
+
isa: 'PBXNativeTarget',
|
|
1312
|
+
name: 'Target1',
|
|
1313
|
+
buildPhases: [
|
|
1314
|
+
{
|
|
1315
|
+
value: 'orphaned-phase-1',
|
|
1316
|
+
comment: 'Upload Debug Symbols to Sentry',
|
|
1317
|
+
},
|
|
1318
|
+
{
|
|
1319
|
+
value: 'valid-phase',
|
|
1320
|
+
comment: 'Sources',
|
|
1321
|
+
},
|
|
1322
|
+
],
|
|
1323
|
+
},
|
|
1324
|
+
'target-2': {
|
|
1325
|
+
isa: 'PBXNativeTarget',
|
|
1326
|
+
name: 'Target2',
|
|
1327
|
+
buildPhases: [
|
|
1328
|
+
{
|
|
1329
|
+
value: 'orphaned-phase-2',
|
|
1330
|
+
comment: 'Upload Debug Symbols to Sentry',
|
|
1331
|
+
},
|
|
1332
|
+
],
|
|
1333
|
+
},
|
|
1334
|
+
};
|
|
1335
|
+
// PBXShellScriptBuildPhase doesn't have the orphaned phases
|
|
1336
|
+
xcodeProject.objects.PBXShellScriptBuildPhase = {
|
|
1337
|
+
'valid-phase': {
|
|
1338
|
+
isa: 'PBXShellScriptBuildPhase',
|
|
1339
|
+
shellScript: '"echo valid"',
|
|
1340
|
+
buildActionMask: 2147483647,
|
|
1341
|
+
files: [],
|
|
1342
|
+
inputPaths: [],
|
|
1343
|
+
outputPaths: [],
|
|
1344
|
+
runOnlyForDeploymentPostprocessing: 0,
|
|
1345
|
+
shellPath: '/bin/sh',
|
|
1346
|
+
},
|
|
1347
|
+
};
|
|
1348
|
+
});
|
|
1349
|
+
(0, vitest_1.it)('should remove orphaned build phase references from all targets', () => {
|
|
1350
|
+
// -- Act --
|
|
1351
|
+
xcodeProject.addUploadSymbolsScript({
|
|
1352
|
+
sentryProject: projectData,
|
|
1353
|
+
targetName: 'Target1',
|
|
1354
|
+
uploadSource: true,
|
|
1355
|
+
});
|
|
1356
|
+
// -- Assert --
|
|
1357
|
+
const target1 = xcodeProject.objects.PBXNativeTarget?.['target-1'];
|
|
1358
|
+
const target2 = xcodeProject.objects.PBXNativeTarget?.['target-2'];
|
|
1359
|
+
// Target1 should only have the valid phase left, plus the new Sentry phase
|
|
1360
|
+
(0, vitest_1.expect)(target1?.buildPhases).not.toEqual(vitest_1.expect.arrayContaining([
|
|
1361
|
+
vitest_1.expect.objectContaining({ value: 'orphaned-phase-1' }),
|
|
1362
|
+
]));
|
|
1363
|
+
(0, vitest_1.expect)(target1?.buildPhases).toEqual(vitest_1.expect.arrayContaining([
|
|
1364
|
+
vitest_1.expect.objectContaining({ value: 'valid-phase' }),
|
|
1365
|
+
]));
|
|
1366
|
+
// Target2 should have orphaned phase removed and be empty
|
|
1367
|
+
(0, vitest_1.expect)(target2?.buildPhases).not.toEqual(vitest_1.expect.arrayContaining([
|
|
1368
|
+
vitest_1.expect.objectContaining({ value: 'orphaned-phase-2' }),
|
|
1369
|
+
]));
|
|
1370
|
+
});
|
|
1371
|
+
});
|
|
1372
|
+
});
|
|
1373
|
+
(0, vitest_1.describe)('addUploadSymbolsScript edge cases', () => {
|
|
1374
|
+
let xcodeProject;
|
|
1375
|
+
(0, vitest_1.beforeEach)(() => {
|
|
1376
|
+
xcodeProject = new xcode_manager_1.XcodeProject(singleTargetProjectPath);
|
|
1377
|
+
});
|
|
1378
|
+
(0, vitest_1.describe)('when target is not found', () => {
|
|
1379
|
+
(0, vitest_1.it)('should handle gracefully without throwing', () => {
|
|
1380
|
+
// -- Act & Assert --
|
|
1381
|
+
(0, vitest_1.expect)(() => {
|
|
1382
|
+
xcodeProject.addUploadSymbolsScript({
|
|
1383
|
+
sentryProject: projectData,
|
|
1384
|
+
targetName: 'NonExistentTarget',
|
|
1385
|
+
uploadSource: true,
|
|
1386
|
+
});
|
|
1387
|
+
}).not.toThrow();
|
|
1388
|
+
});
|
|
1389
|
+
});
|
|
1390
|
+
});
|
|
1391
|
+
(0, vitest_1.describe)('addScriptBuildPhase method coverage', () => {
|
|
1392
|
+
let sourceProjectPath;
|
|
1393
|
+
let tempProjectPath;
|
|
1394
|
+
let xcodeProject;
|
|
1395
|
+
(0, vitest_1.beforeEach)(() => {
|
|
1396
|
+
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'add-script-build-phase'));
|
|
1397
|
+
sourceProjectPath = singleTargetProjectPath;
|
|
1398
|
+
tempProjectPath = path.resolve(tempDir, 'project.pbxproj');
|
|
1399
|
+
fs.copyFileSync(sourceProjectPath, tempProjectPath);
|
|
1400
|
+
xcodeProject = new xcode_manager_1.XcodeProject(tempProjectPath);
|
|
1401
|
+
});
|
|
1402
|
+
(0, vitest_1.describe)('when PBXShellScriptBuildPhase does not exist initially', () => {
|
|
1403
|
+
(0, vitest_1.it)('should initialize PBXShellScriptBuildPhase and add build phase', () => {
|
|
1404
|
+
// -- Arrange --
|
|
1405
|
+
// Set PBXShellScriptBuildPhase to empty to test initialization path
|
|
1406
|
+
delete xcodeProject.objects.PBXShellScriptBuildPhase;
|
|
1407
|
+
const targetKey = 'D4E604CC2D50CEEC00CAB00F';
|
|
1408
|
+
// -- Act --
|
|
1409
|
+
const buildPhaseId = xcodeProject.addScriptBuildPhase(targetKey, 'Test Script', 'echo "test"', ['input.txt']);
|
|
1410
|
+
// -- Assert --
|
|
1411
|
+
(0, vitest_1.expect)(xcodeProject.objects.PBXShellScriptBuildPhase).toBeDefined();
|
|
1412
|
+
(0, vitest_1.expect)(buildPhaseId).toMatch(/^[A-F0-9]{24}$/i);
|
|
1413
|
+
const buildPhase = xcodeProject.objects.PBXShellScriptBuildPhase?.[buildPhaseId];
|
|
1414
|
+
(0, vitest_1.expect)(buildPhase).toBeDefined();
|
|
1415
|
+
(0, vitest_1.expect)(typeof buildPhase).not.toBe('string');
|
|
1416
|
+
});
|
|
1417
|
+
});
|
|
1418
|
+
(0, vitest_1.describe)('when target does not exist', () => {
|
|
1419
|
+
(0, vitest_1.it)('should still create build phase but not add to target', () => {
|
|
1420
|
+
// -- Arrange --
|
|
1421
|
+
const invalidTargetKey = 'INVALID_TARGET_KEY';
|
|
1422
|
+
// -- Act --
|
|
1423
|
+
const buildPhaseId = xcodeProject.addScriptBuildPhase(invalidTargetKey, 'Test Script', 'echo "test"', []);
|
|
1424
|
+
// -- Assert --
|
|
1425
|
+
(0, vitest_1.expect)(buildPhaseId).toMatch(/^[A-F0-9]{24}$/i);
|
|
1426
|
+
// Build phase should be created in PBXShellScriptBuildPhase
|
|
1427
|
+
const buildPhase = xcodeProject.objects.PBXShellScriptBuildPhase?.[buildPhaseId];
|
|
1428
|
+
(0, vitest_1.expect)(buildPhase).toBeDefined();
|
|
1429
|
+
// But target should not have the build phase added since target doesn't exist
|
|
1430
|
+
const target = xcodeProject.objects.PBXNativeTarget?.[invalidTargetKey];
|
|
1431
|
+
(0, vitest_1.expect)(target).toBeUndefined();
|
|
1432
|
+
});
|
|
1433
|
+
});
|
|
1434
|
+
(0, vitest_1.describe)('when target has no buildPhases array', () => {
|
|
1435
|
+
(0, vitest_1.it)('should not add build phase to target but should create build phase object', () => {
|
|
1436
|
+
// -- Arrange --
|
|
1437
|
+
const targetKey = 'D4E604CC2D50CEEC00CAB00F';
|
|
1438
|
+
const target = xcodeProject.objects.PBXNativeTarget?.[targetKey];
|
|
1439
|
+
if (target && typeof target !== 'string') {
|
|
1440
|
+
// Remove buildPhases to test the undefined case
|
|
1441
|
+
const targetWithoutBuildPhases = target;
|
|
1442
|
+
delete targetWithoutBuildPhases.buildPhases;
|
|
1443
|
+
}
|
|
1444
|
+
// -- Act --
|
|
1445
|
+
const buildPhaseId = xcodeProject.addScriptBuildPhase(targetKey, 'Test Script', 'echo "test"', []);
|
|
1446
|
+
// -- Assert --
|
|
1447
|
+
(0, vitest_1.expect)(buildPhaseId).toMatch(/^[A-F0-9]{24}$/i);
|
|
1448
|
+
// Build phase should be created
|
|
1449
|
+
const buildPhase = xcodeProject.objects.PBXShellScriptBuildPhase?.[buildPhaseId];
|
|
1450
|
+
(0, vitest_1.expect)(buildPhase).toBeDefined();
|
|
1451
|
+
// Target should exist but buildPhases should still be undefined
|
|
1452
|
+
const updatedTarget = xcodeProject.objects.PBXNativeTarget?.[targetKey];
|
|
1453
|
+
(0, vitest_1.expect)(updatedTarget).toBeDefined();
|
|
1454
|
+
(0, vitest_1.expect)(updatedTarget?.buildPhases).toBeUndefined();
|
|
1455
|
+
});
|
|
1456
|
+
});
|
|
1457
|
+
});
|
|
1458
|
+
(0, vitest_1.describe)('updateScriptBuildPhase method coverage', () => {
|
|
1459
|
+
let sourceProjectPath;
|
|
1460
|
+
let tempProjectPath;
|
|
1461
|
+
let xcodeProject;
|
|
1462
|
+
(0, vitest_1.beforeEach)(() => {
|
|
1463
|
+
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'update-script-build-phase'));
|
|
1464
|
+
sourceProjectPath = singleTargetProjectPath;
|
|
1465
|
+
tempProjectPath = path.resolve(tempDir, 'project.pbxproj');
|
|
1466
|
+
fs.copyFileSync(sourceProjectPath, tempProjectPath);
|
|
1467
|
+
xcodeProject = new xcode_manager_1.XcodeProject(tempProjectPath);
|
|
1468
|
+
});
|
|
1469
|
+
(0, vitest_1.describe)('when build phase does not exist', () => {
|
|
1470
|
+
(0, vitest_1.it)('should debug and return early', () => {
|
|
1471
|
+
// -- Act & Assert --
|
|
1472
|
+
(0, vitest_1.expect)(() => {
|
|
1473
|
+
xcodeProject.updateScriptBuildPhase('NONEXISTENT_BUILD_PHASE', 'echo "updated"', ['input.txt']);
|
|
1474
|
+
}).not.toThrow();
|
|
1475
|
+
});
|
|
1476
|
+
});
|
|
1477
|
+
(0, vitest_1.describe)('when build phase is a string comment', () => {
|
|
1478
|
+
(0, vitest_1.it)('should debug and return early', () => {
|
|
1479
|
+
// -- Arrange --
|
|
1480
|
+
xcodeProject.objects.PBXShellScriptBuildPhase = {
|
|
1481
|
+
'test-id': 'This is a comment string',
|
|
1482
|
+
};
|
|
1483
|
+
// -- Act & Assert --
|
|
1484
|
+
(0, vitest_1.expect)(() => {
|
|
1485
|
+
xcodeProject.updateScriptBuildPhase('test-id', 'echo "updated"', [
|
|
1486
|
+
'input.txt',
|
|
1487
|
+
]);
|
|
1488
|
+
}).not.toThrow();
|
|
1489
|
+
});
|
|
1490
|
+
});
|
|
1491
|
+
(0, vitest_1.describe)('when build phase exists and is valid', () => {
|
|
1492
|
+
(0, vitest_1.it)('should update the build phase successfully', () => {
|
|
1493
|
+
// -- Arrange --
|
|
1494
|
+
const buildPhaseId = 'test-build-phase-id';
|
|
1495
|
+
xcodeProject.objects.PBXShellScriptBuildPhase = {
|
|
1496
|
+
[buildPhaseId]: {
|
|
1497
|
+
isa: 'PBXShellScriptBuildPhase',
|
|
1498
|
+
shellScript: '"echo \\"old script\\""',
|
|
1499
|
+
inputPaths: ['old-input.txt'],
|
|
1500
|
+
shellPath: '/bin/sh',
|
|
1501
|
+
buildActionMask: 2147483647,
|
|
1502
|
+
files: [],
|
|
1503
|
+
outputPaths: [],
|
|
1504
|
+
runOnlyForDeploymentPostprocessing: 0,
|
|
1505
|
+
},
|
|
1506
|
+
};
|
|
1507
|
+
// -- Act --
|
|
1508
|
+
xcodeProject.updateScriptBuildPhase(buildPhaseId, 'echo "new script"', ['new-input.txt']);
|
|
1509
|
+
// -- Assert --
|
|
1510
|
+
const buildPhase = xcodeProject.objects.PBXShellScriptBuildPhase?.[buildPhaseId];
|
|
1511
|
+
(0, vitest_1.expect)(buildPhase).toBeDefined();
|
|
1512
|
+
(0, vitest_1.expect)(buildPhase?.shellScript).toBe('"echo \\"new script\\""');
|
|
1513
|
+
(0, vitest_1.expect)(buildPhase?.inputPaths).toEqual(['new-input.txt']);
|
|
1514
|
+
(0, vitest_1.expect)(buildPhase?.shellPath).toBe('/bin/sh');
|
|
1515
|
+
});
|
|
1516
|
+
});
|
|
1517
|
+
});
|
|
1518
|
+
(0, vitest_1.describe)('addUploadSymbolsScript method comprehensive coverage', () => {
|
|
1519
|
+
let sourceProjectPath;
|
|
1520
|
+
let tempProjectPath;
|
|
1521
|
+
let xcodeProject;
|
|
1522
|
+
(0, vitest_1.beforeEach)(() => {
|
|
1523
|
+
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'add-upload-symbols-comprehensive'));
|
|
1524
|
+
sourceProjectPath = singleTargetProjectPath;
|
|
1525
|
+
tempProjectPath = path.resolve(tempDir, 'project.pbxproj');
|
|
1526
|
+
fs.copyFileSync(sourceProjectPath, tempProjectPath);
|
|
1527
|
+
xcodeProject = new xcode_manager_1.XcodeProject(tempProjectPath);
|
|
1528
|
+
});
|
|
1529
|
+
(0, vitest_1.describe)('when PBXShellScriptBuildPhase does not exist initially', () => {
|
|
1530
|
+
(0, vitest_1.it)('should initialize PBXShellScriptBuildPhase and add new build phase', () => {
|
|
1531
|
+
// -- Arrange --
|
|
1532
|
+
delete xcodeProject.objects.PBXShellScriptBuildPhase;
|
|
1533
|
+
// -- Act --
|
|
1534
|
+
xcodeProject.addUploadSymbolsScript({
|
|
1535
|
+
sentryProject: projectData,
|
|
1536
|
+
targetName: 'Project',
|
|
1537
|
+
uploadSource: true,
|
|
1538
|
+
});
|
|
1539
|
+
// -- Assert --
|
|
1540
|
+
(0, vitest_1.expect)(xcodeProject.objects.PBXShellScriptBuildPhase).toBeDefined();
|
|
1541
|
+
// Should have created a new build phase
|
|
1542
|
+
const buildPhases = Object.keys(xcodeProject.objects.PBXShellScriptBuildPhase || {});
|
|
1543
|
+
const actualBuildPhases = buildPhases.filter((key) => !key.endsWith('_comment'));
|
|
1544
|
+
(0, vitest_1.expect)(actualBuildPhases.length).toBeGreaterThan(0);
|
|
1545
|
+
});
|
|
1546
|
+
});
|
|
1547
|
+
(0, vitest_1.describe)('when target has buildPhases but no existing Sentry script', () => {
|
|
1548
|
+
(0, vitest_1.it)('should iterate through buildPhases and add new script', () => {
|
|
1549
|
+
// -- Arrange --
|
|
1550
|
+
// Ensure target has buildPhases but none contain sentry-cli
|
|
1551
|
+
const targetKey = 'D4E604CC2D50CEEC00CAB00F';
|
|
1552
|
+
const target = xcodeProject.objects.PBXNativeTarget?.[targetKey];
|
|
1553
|
+
if (target && typeof target !== 'string') {
|
|
1554
|
+
target.buildPhases = [
|
|
1555
|
+
{ value: 'some-other-phase', comment: 'Sources' },
|
|
1556
|
+
{ value: 'another-phase', comment: 'Frameworks' },
|
|
1557
|
+
];
|
|
1558
|
+
}
|
|
1559
|
+
// Ensure PBXShellScriptBuildPhase exists but without sentry-cli scripts
|
|
1560
|
+
xcodeProject.objects.PBXShellScriptBuildPhase = {
|
|
1561
|
+
'some-other-phase': {
|
|
1562
|
+
isa: 'PBXShellScriptBuildPhase',
|
|
1563
|
+
shellScript: '"echo \\"other script\\""',
|
|
1564
|
+
buildActionMask: 2147483647,
|
|
1565
|
+
files: [],
|
|
1566
|
+
inputPaths: [],
|
|
1567
|
+
outputPaths: [],
|
|
1568
|
+
runOnlyForDeploymentPostprocessing: 0,
|
|
1569
|
+
shellPath: '/bin/sh',
|
|
1570
|
+
},
|
|
1571
|
+
'another-phase': {
|
|
1572
|
+
isa: 'PBXShellScriptBuildPhase',
|
|
1573
|
+
shellScript: '"echo \\"another script\\""',
|
|
1574
|
+
buildActionMask: 2147483647,
|
|
1575
|
+
files: [],
|
|
1576
|
+
inputPaths: [],
|
|
1577
|
+
outputPaths: [],
|
|
1578
|
+
runOnlyForDeploymentPostprocessing: 0,
|
|
1579
|
+
shellPath: '/bin/sh',
|
|
1580
|
+
},
|
|
1581
|
+
};
|
|
1582
|
+
// -- Act --
|
|
1583
|
+
xcodeProject.addUploadSymbolsScript({
|
|
1584
|
+
sentryProject: projectData,
|
|
1585
|
+
targetName: 'Project',
|
|
1586
|
+
uploadSource: true,
|
|
1587
|
+
});
|
|
1588
|
+
// -- Assert --
|
|
1589
|
+
// Should have added a new Sentry build phase (calls addScriptBuildPhase path)
|
|
1590
|
+
const buildPhases = Object.keys(xcodeProject.objects.PBXShellScriptBuildPhase || {});
|
|
1591
|
+
const actualBuildPhases = buildPhases.filter((key) => !key.endsWith('_comment'));
|
|
1592
|
+
(0, vitest_1.expect)(actualBuildPhases.length).toBeGreaterThan(2); // Should have more than the original 2
|
|
1593
|
+
// Find the new Sentry script
|
|
1594
|
+
const sentryPhase = actualBuildPhases.find((phaseId) => {
|
|
1595
|
+
const phase = xcodeProject.objects.PBXShellScriptBuildPhase?.[phaseId];
|
|
1596
|
+
return (phase &&
|
|
1597
|
+
typeof phase !== 'string' &&
|
|
1598
|
+
phase.shellScript?.includes('sentry-cli'));
|
|
1599
|
+
});
|
|
1600
|
+
(0, vitest_1.expect)(sentryPhase).toBeDefined();
|
|
1601
|
+
});
|
|
1602
|
+
});
|
|
1603
|
+
(0, vitest_1.describe)('when target has no buildPhases', () => {
|
|
1604
|
+
(0, vitest_1.it)('should skip the buildPhases iteration and add new script', () => {
|
|
1605
|
+
// -- Arrange --
|
|
1606
|
+
const targetKey = 'D4E604CC2D50CEEC00CAB00F';
|
|
1607
|
+
const target = xcodeProject.objects.PBXNativeTarget?.[targetKey];
|
|
1608
|
+
if (target && typeof target !== 'string') {
|
|
1609
|
+
// Set buildPhases to undefined to test the skip path
|
|
1610
|
+
target.buildPhases = undefined;
|
|
1611
|
+
}
|
|
1612
|
+
// -- Act --
|
|
1613
|
+
xcodeProject.addUploadSymbolsScript({
|
|
1614
|
+
sentryProject: projectData,
|
|
1615
|
+
targetName: 'Project',
|
|
1616
|
+
uploadSource: true,
|
|
1617
|
+
});
|
|
1618
|
+
// -- Assert --
|
|
1619
|
+
// Should have added a new Sentry build phase via the else branch (addScriptBuildPhase)
|
|
1620
|
+
const buildPhases = Object.keys(xcodeProject.objects.PBXShellScriptBuildPhase || {});
|
|
1621
|
+
const actualBuildPhases = buildPhases.filter((key) => !key.endsWith('_comment'));
|
|
1622
|
+
(0, vitest_1.expect)(actualBuildPhases.length).toBeGreaterThan(0);
|
|
1623
|
+
// Find the new Sentry script
|
|
1624
|
+
const sentryPhase = actualBuildPhases.find((phaseId) => {
|
|
1625
|
+
const phase = xcodeProject.objects.PBXShellScriptBuildPhase?.[phaseId];
|
|
1626
|
+
return (phase &&
|
|
1627
|
+
typeof phase !== 'string' &&
|
|
1628
|
+
phase.shellScript?.includes('sentry-cli'));
|
|
1629
|
+
});
|
|
1630
|
+
(0, vitest_1.expect)(sentryPhase).toBeDefined();
|
|
1631
|
+
});
|
|
1632
|
+
});
|
|
1633
|
+
});
|
|
1216
1634
|
});
|
|
1217
1635
|
});
|
|
1218
1636
|
//# sourceMappingURL=xcode-manager.test.js.map
|