@sentry/wizard 4.8.0 → 5.0.0

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.
Files changed (124) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/e2e-tests/tests/angular-17.test.js +41 -41
  3. package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
  4. package/dist/e2e-tests/tests/angular-19.test.js +39 -39
  5. package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
  6. package/dist/e2e-tests/tests/expo.test.js +10 -2
  7. package/dist/e2e-tests/tests/expo.test.js.map +1 -1
  8. package/dist/e2e-tests/tests/react-native.test.js +38 -3
  9. package/dist/e2e-tests/tests/react-native.test.js.map +1 -1
  10. package/dist/e2e-tests/utils/index.js +14 -6
  11. package/dist/e2e-tests/utils/index.js.map +1 -1
  12. package/dist/lib/Helper/SentryCli.d.ts +0 -11
  13. package/dist/lib/Helper/SentryCli.js +0 -52
  14. package/dist/lib/Helper/SentryCli.js.map +1 -1
  15. package/dist/lib/Steps/Integrations/Cordova.js +13 -30
  16. package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
  17. package/dist/src/android/templates.js +2 -0
  18. package/dist/src/android/templates.js.map +1 -1
  19. package/dist/src/angular/angular-wizard.js +1 -1
  20. package/dist/src/angular/angular-wizard.js.map +1 -1
  21. package/dist/src/angular/sdk-setup.d.ts +1 -1
  22. package/dist/src/angular/sdk-setup.js +3 -3
  23. package/dist/src/angular/sdk-setup.js.map +1 -1
  24. package/dist/src/apple/code-tools.d.ts +4 -2
  25. package/dist/src/apple/code-tools.js +21 -11
  26. package/dist/src/apple/code-tools.js.map +1 -1
  27. package/dist/src/apple/inject-code-snippet.js +5 -3
  28. package/dist/src/apple/inject-code-snippet.js.map +1 -1
  29. package/dist/src/apple/macos-system-helper.d.ts +5 -0
  30. package/dist/src/apple/macos-system-helper.js +86 -0
  31. package/dist/src/apple/macos-system-helper.js.map +1 -0
  32. package/dist/src/apple/templates.js +10 -0
  33. package/dist/src/apple/templates.js.map +1 -1
  34. package/dist/src/apple/xcode-manager.d.ts +237 -11
  35. package/dist/src/apple/xcode-manager.js +736 -65
  36. package/dist/src/apple/xcode-manager.js.map +1 -1
  37. package/dist/src/apple/xcode-project-object-with-id.d.ts +5 -0
  38. package/dist/src/apple/xcode-project-object-with-id.js +3 -0
  39. package/dist/src/apple/xcode-project-object-with-id.js.map +1 -0
  40. package/dist/src/flutter/templates.js +7 -1
  41. package/dist/src/flutter/templates.js.map +1 -1
  42. package/dist/src/nextjs/nextjs-wizard.js +1 -3
  43. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  44. package/dist/src/nuxt/nuxt-wizard.js +1 -3
  45. package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
  46. package/dist/src/react-native/expo-env-file.js +5 -0
  47. package/dist/src/react-native/expo-env-file.js.map +1 -1
  48. package/dist/src/react-native/expo-metro.js +18 -5
  49. package/dist/src/react-native/expo-metro.js.map +1 -1
  50. package/dist/src/react-native/expo.js +6 -0
  51. package/dist/src/react-native/expo.js.map +1 -1
  52. package/dist/src/react-native/glob.js +14 -4
  53. package/dist/src/react-native/glob.js.map +1 -1
  54. package/dist/src/react-native/gradle.d.ts +0 -1
  55. package/dist/src/react-native/gradle.js +15 -9
  56. package/dist/src/react-native/gradle.js.map +1 -1
  57. package/dist/src/react-native/javascript.d.ts +9 -4
  58. package/dist/src/react-native/javascript.js +44 -22
  59. package/dist/src/react-native/javascript.js.map +1 -1
  60. package/dist/src/react-native/metro.d.ts +1 -5
  61. package/dist/src/react-native/metro.js +18 -120
  62. package/dist/src/react-native/metro.js.map +1 -1
  63. package/dist/src/react-native/options.d.ts +1 -3
  64. package/dist/src/react-native/options.js.map +1 -1
  65. package/dist/src/react-native/react-native-wizard.d.ts +1 -19
  66. package/dist/src/react-native/react-native-wizard.js +27 -101
  67. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  68. package/dist/src/react-native/xcode.d.ts +0 -7
  69. package/dist/src/react-native/xcode.js +15 -108
  70. package/dist/src/react-native/xcode.js.map +1 -1
  71. package/dist/src/remix/remix-wizard.js +1 -3
  72. package/dist/src/remix/remix-wizard.js.map +1 -1
  73. package/dist/src/run.js +1 -4
  74. package/dist/src/run.js.map +1 -1
  75. package/dist/src/sourcemaps/utils/sdk-version.js +3 -0
  76. package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -1
  77. package/dist/src/sveltekit/sveltekit-wizard.js +1 -3
  78. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  79. package/dist/src/utils/ast-utils.d.ts +0 -7
  80. package/dist/src/utils/ast-utils.js +1 -27
  81. package/dist/src/utils/ast-utils.js.map +1 -1
  82. package/dist/src/utils/clack/index.d.ts +2 -12
  83. package/dist/src/utils/clack/index.js +8 -47
  84. package/dist/src/utils/clack/index.js.map +1 -1
  85. package/dist/src/utils/git.d.ts +11 -0
  86. package/dist/src/utils/git.js +69 -0
  87. package/dist/src/utils/git.js.map +1 -0
  88. package/dist/src/utils/sentrycli-utils.js +13 -4
  89. package/dist/src/utils/sentrycli-utils.js.map +1 -1
  90. package/dist/src/version.d.ts +1 -1
  91. package/dist/src/version.js +1 -1
  92. package/dist/src/version.js.map +1 -1
  93. package/dist/test/apple/code-tools.test.js +54 -35
  94. package/dist/test/apple/code-tools.test.js.map +1 -1
  95. package/dist/test/apple/configure-sentry-cli.test.d.ts +1 -0
  96. package/dist/test/apple/configure-sentry-cli.test.js +131 -0
  97. package/dist/test/apple/configure-sentry-cli.test.js.map +1 -0
  98. package/dist/test/apple/macos-system-helper-mocked.test.d.ts +1 -0
  99. package/dist/test/apple/macos-system-helper-mocked.test.js +46 -0
  100. package/dist/test/apple/macos-system-helper-mocked.test.js.map +1 -0
  101. package/dist/test/apple/macos-system-helper.test.d.ts +1 -0
  102. package/dist/test/apple/macos-system-helper.test.js +88 -0
  103. package/dist/test/apple/macos-system-helper.test.js.map +1 -0
  104. package/dist/test/apple/templates.test.js +10 -0
  105. package/dist/test/apple/templates.test.js.map +1 -1
  106. package/dist/test/apple/xcode-manager.test.js +745 -379
  107. package/dist/test/apple/xcode-manager.test.js.map +1 -1
  108. package/dist/test/flutter/templates.test.js +9 -0
  109. package/dist/test/flutter/templates.test.js.map +1 -1
  110. package/dist/test/react-native/gradle.test.js +0 -119
  111. package/dist/test/react-native/gradle.test.js.map +1 -1
  112. package/dist/test/react-native/javascript.test.js +119 -0
  113. package/dist/test/react-native/javascript.test.js.map +1 -1
  114. package/dist/test/react-native/metro.test.js +0 -90
  115. package/dist/test/react-native/metro.test.js.map +1 -1
  116. package/dist/test/react-native/xcode.test.js +0 -81
  117. package/dist/test/react-native/xcode.test.js.map +1 -1
  118. package/dist/test/utils/git.test.d.ts +1 -0
  119. package/dist/test/utils/git.test.js +70 -0
  120. package/dist/test/utils/git.test.js.map +1 -0
  121. package/package.json +1 -1
  122. package/dist/src/react-native/uninstall.d.ts +0 -2
  123. package/dist/src/react-native/uninstall.js +0 -94
  124. package/dist/src/react-native/uninstall.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"code-tools.test.js","sourceRoot":"","sources":["../../../test/apple/code-tools.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AACvC,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,2DAGoC;AACpC,+EAA+E;AAC/E,sDAAwC;AACxC,mCAAyE;AAEzE,iBAAiB;AACjB,MAAM,uBAAuB,GAAG,uBAAuB,CAAC;AACxD,MAAM,qBAAqB,GAAG;;;;;;;;;;EAU5B,CAAC;AACH,MAAM,+BAA+B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCtC,CAAC;AACH,MAAM,sBAAsB,GAAG;;;EAG7B,CAAC;AACH,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;KAcxB,CAAC;AACN,MAAM,8BAA8B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmClC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EAAE,GAAG,CAAC,CAAC;oBAEjE,eAAe;oBACf,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC;oBAC5B,IAAA,eAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,oBAAoB,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;gBACtE,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as Sentry from '@sentry/node';\nimport * as fs from 'fs';\nimport * as os from 'os';\nimport * as path from 'path';\nimport {\n addCodeSnippetToProject,\n exportForTesting,\n} from '../../src/apple/code-tools';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';\n\n// Test Constants\nconst invalidAppDelegateSwift = `func application() {}`;\nconst validAppDelegateSwift = `\nimport UIKit\n\n@main\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {\n // Override point for customization after application launch.\n return true\n }\n}`;\nconst validAppDelegateSwiftWithSentry = `\nimport UIKit\nimport Sentry\n\n\n@main\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {\n SentrySDK.start { options in\n options.dsn = \"https://example.com/sentry-dsn\"\n options.debug = true // Enabled debug when first installing is always helpful\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 // Override point for customization after application launch.\n return true\n }\n}`;\nconst invalidAppDelegateObjC = `\n- (BOOL)application:(UIApplication *) {\n return NO;\n}`;\nconst validAppDelegateObjC = `\n#import \"AppDelegate.h\"\n\n@interface AppDelegate ()\n\n@end\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n // Override point for customization after application launch.\n return YES;\n}\n\n@end`;\nconst validAppDelegateObjCWithSentry = `@import Sentry;\n\n#import \"AppDelegate.h\"\n\n@interface AppDelegate ()\n\n@end\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n [SentrySDK startWithConfigureOptions:^(SentryOptions * options) {\n options.dsn = @\"https://example.com/sentry-dsn\";\n options.debug = YES; // Enabled debug when first installing is always helpful\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 // Override point for customization after application launch.\n return YES;\n}\n\n@end`;\nconst invalidAppDelegateSwiftUI = `\nstruct MyApp: App {\n var body: some Scene {\n WindowGroup { Text(\"Hello, world!\") }\n }\n}`;\nconst validAppDelegateSwiftUI = `\nimport SwiftUI\n\n@main\nstruct TestApp: App {\n var body: some Scene {\n WindowGroup {\n ContentView()\n }\n }\n}`;\nconst validAppDelegateSwiftUIWithSentry = `\nimport SwiftUI\nimport Sentry\n\n\n@main\nstruct TestApp: App {\n init() {\n SentrySDK.start { options in\n options.dsn = \"https://example.com/sentry-dsn\"\n options.debug = true // Enabled debug when first installing is always helpful\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 var body: some Scene {\n WindowGroup {\n ContentView()\n }\n }\n}`;\n\nconst prepareTempDir = (): string => {\n const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'code-tools-test'));\n return tempDir;\n};\n\nconst prepareAppDelegateFile = (\n dir: string,\n content: string,\n ext: 'm' | 'mm' | 'swift',\n): string => {\n const filePath = path.join(dir, `AppDelegate.${ext}`);\n fs.writeFileSync(filePath, content, 'utf8');\n return filePath;\n};\n\nconst dsn = 'https://example.com/sentry-dsn';\n\n// Mock Setup\n\nvi.mock('../../src/utils/bash');\nvi.spyOn(Sentry, 'setTag').mockImplementation(() => undefined);\nvi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');\n\n// Test Suite\n\ndescribe('code-tools', () => {\n beforeEach(() => {\n vi.spyOn(clack.log, 'info').mockImplementation(() => undefined);\n });\n\n afterEach(() => {\n vi.clearAllMocks();\n });\n\n describe('#isAppDelegateFile', () => {\n const prepareTestFile = (\n content: string,\n ext: 'm' | 'mm' | 'swift',\n ): string => {\n const tempDir = prepareTempDir();\n return prepareAppDelegateFile(tempDir, content, ext);\n };\n\n describe('swift files', () => {\n describe('swift app launch regex', () => {\n describe('valid cases', () => {\n const variations: {\n name: string;\n code: string;\n }[] = [\n {\n name: 'with underscores',\n code: 'func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {',\n },\n {\n name: 'with different dictionary type',\n code: 'func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {',\n },\n {\n name: 'with extra whitespace',\n code: ' func application ( _ application: UIApplication , didFinishLaunchingWithOptions launchOptions: [ NSObject : AnyObject ]? ) -> Bool { ',\n },\n {\n name: 'macOS notification variant',\n code: 'func applicationDidFinishLaunching(_ aNotification: Notification) {',\n },\n {\n name: 'macOS with extra whitespace',\n code: 'func applicationDidFinishLaunching ( _ aNotification: Notification ) {',\n },\n ];\n\n for (const variation of variations) {\n describe(`${variation.name}`, () => {\n it(`should return true`, () => {\n // -- Arrange --\n const filePath = prepareTestFile(variation.code, 'swift');\n\n // -- Act --\n const result = exportForTesting.isAppDelegateFile(filePath);\n\n // -- Assert --\n expect(result).toBeTruthy();\n });\n });\n }\n\n describe('invalid cases', () => {\n const variations: {\n name: string;\n code: string;\n }[] = [\n {\n name: 'missing application method',\n code: 'import UIKit',\n },\n {\n name: 'typo in method name',\n code: 'func applicatioM(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {',\n },\n {\n name: 'garbage input',\n code: 'asdf;jk23;uas()d{',\n },\n ];\n\n for (const variation of variations) {\n describe(`${variation.name}`, () => {\n it('should return false', () => {\n // -- Arrange --\n const filePath = prepareTestFile(variation.code, 'swift');\n\n // -- Act --\n const result = exportForTesting.isAppDelegateFile(filePath);\n\n // -- Assert --\n expect(result).toBeFalsy();\n });\n });\n }\n });\n });\n });\n });\n\n describe('objc files', () => {\n describe('valid cases', () => {\n const variations: {\n name: string;\n code: string;\n }[] = [\n {\n name: 'basic',\n code: '- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {',\n },\n {\n name: 'with more whitespace',\n code: '- ( BOOL ) application: ( UIApplication * ) application didFinishLaunchingWithOptions: ( NSDictionary * ) launchOptions {',\n },\n ];\n\n for (const variation of variations) {\n describe(`${variation.name}`, () => {\n it('should return true', () => {\n // -- Arrange --\n const filePath = prepareTestFile(variation.code, 'm');\n\n // -- Act --\n const result = exportForTesting.isAppDelegateFile(filePath);\n\n // -- Assert --\n expect(result).toBeTruthy();\n });\n });\n }\n });\n\n describe('invalid cases', () => {\n const variations: {\n name: string;\n code: string;\n }[] = [\n {\n name: 'missing application method',\n code: 'import UIKit',\n },\n ];\n\n for (const variation of variations) {\n describe(`${variation.name}`, () => {\n it('should return false', () => {\n // -- Arrange --\n const filePath = prepareTestFile(variation.code, 'm');\n\n // -- Act --\n const result = exportForTesting.isAppDelegateFile(filePath);\n\n // -- Assert --\n expect(result).toBeFalsy();\n });\n });\n }\n });\n });\n\n describe('swiftui files', () => {\n describe('valid cases', () => {\n const variations: {\n name: string;\n code: string;\n }[] = [\n {\n name: 'basic',\n code: '@main struct MyApp: App {',\n },\n {\n name: 'with more whitespace',\n code: '@main struct MyApp: App {',\n },\n {\n name: 'with SwiftUI namespace',\n code: '@main struct App: SwiftUI.App {',\n },\n ];\n\n for (const variation of variations) {\n describe(`${variation.name}`, () => {\n it('should return true', () => {\n // -- Arrange --\n const filePath = prepareTestFile(variation.code, 'swift');\n\n // -- Act --\n const result = exportForTesting.isAppDelegateFile(filePath);\n\n // -- Assert --\n expect(result).toBeTruthy();\n });\n });\n }\n });\n\n describe('invalid cases', () => {\n const variations: {\n name: string;\n code: string;\n }[] = [\n {\n name: 'missing @main',\n code: 'struct App: App {',\n },\n {\n name: 'missing super-type App',\n code: 'struct MyApp {',\n },\n {\n name: 'imported not from SwiftUI',\n code: '@main struct App: MySwiftyUI.App {',\n },\n {\n name: 'imported not from SwiftUI but similar',\n code: '@main struct App: MySwiftUI.App {',\n },\n ];\n\n for (const variation of variations) {\n describe(`${variation.name}`, () => {\n it('should return false', () => {\n // -- Arrange --\n const filePath = prepareTestFile(variation.code, 'swift');\n\n // -- Act --\n const result = exportForTesting.isAppDelegateFile(filePath);\n\n // -- Assert --\n expect(result).toBeFalsy();\n });\n });\n }\n });\n });\n\n describe('file not found', () => {\n it('should throw an error', () => {\n // -- Arrange --\n const invalidPath = path.join(os.tmpdir(), 'invalid-path');\n\n // -- Act & Assert --\n expect(() => exportForTesting.isAppDelegateFile(invalidPath)).toThrow();\n });\n });\n });\n\n describe('#findAppDidFinishLaunchingWithOptions', () => {\n describe('no files given', () => {\n it('should check files in directory', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateSwift,\n 'swift',\n );\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);\n\n // -- Assert --\n expect(result).toBe(filePath);\n });\n });\n\n describe('SwiftUI file found', () => {\n describe('is app delegate', () => {\n it('should return the file path', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateSwiftUI,\n 'swift',\n );\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);\n\n // -- Assert --\n expect(result).toBe(filePath);\n });\n });\n\n describe('is not app delegate', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n prepareAppDelegateFile(tempDir, invalidAppDelegateSwiftUI, 'swift');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n });\n\n describe('Swift file found', () => {\n describe('is app delegate', () => {\n it('should return the file path', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateSwift,\n 'swift',\n );\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);\n\n // -- Assert --\n expect(result).toBe(filePath);\n });\n });\n\n describe('is not app delegate', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n prepareAppDelegateFile(tempDir, invalidAppDelegateSwift, 'swift');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n });\n\n describe('Objective-C file found', () => {\n describe('is app delegate', () => {\n it('should return the file path', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateObjC,\n 'm',\n );\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);\n\n // -- Assert --\n expect(result).toBe(filePath);\n });\n });\n\n describe('is not app delegate', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n prepareAppDelegateFile(tempDir, invalidAppDelegateObjC, 'm');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n });\n\n describe('Objective-C++ file found', () => {\n describe('is app delegate', () => {\n it('should return the file path', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateObjC,\n 'mm',\n );\n\n // -- Act --\n const result = exportForTesting.findAppDidFinishLaunchingWithOptions(\n tempDir,\n [filePath],\n );\n\n // -- Assert --\n expect(result).toBe(filePath);\n });\n });\n\n describe('is not app delegate', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n prepareAppDelegateFile(tempDir, invalidAppDelegateObjC, 'mm');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n });\n\n describe('file in list not found', () => {\n it('should return null', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n invalidAppDelegateSwift,\n 'swift',\n );\n\n // -- Act --\n const result = exportForTesting.findAppDidFinishLaunchingWithOptions(\n tempDir,\n [filePath],\n );\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n\n describe('unrelated file found', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n invalidAppDelegateSwift,\n 'swift',\n );\n\n // -- Act --\n const result = exportForTesting.findAppDidFinishLaunchingWithOptions(\n tempDir,\n [filePath],\n );\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n\n describe('directory in list', () => {\n describe('name starts with dot', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n\n const hiddenDir = path.join(tempDir, '.hidden');\n fs.mkdirSync(hiddenDir);\n\n prepareAppDelegateFile(hiddenDir, validAppDelegateSwift, 'swift');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n\n describe('name ends with .xcodeproj', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const xcodeDir = path.join(tempDir, 'MyProject.xcodeproj');\n fs.mkdirSync(xcodeDir);\n\n prepareAppDelegateFile(xcodeDir, validAppDelegateSwift, 'swift');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n\n describe('name ends with .xcassets', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const xcassetsDir = path.join(tempDir, 'MyProject.xcassets');\n fs.mkdirSync(xcassetsDir);\n\n prepareAppDelegateFile(xcassetsDir, validAppDelegateSwift, 'swift');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n\n describe('is not a directory', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = path.join(tempDir, 'some-file');\n fs.writeFileSync(filePath, validAppDelegateSwift, 'utf8');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n });\n\n describe('multiple files could be app delegate', () => {\n it('should return the first one', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateSwift,\n 'swift',\n );\n prepareAppDelegateFile(tempDir, validAppDelegateSwift, 'swift');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);\n\n // -- Assert --\n expect(result).toBe(filePath);\n });\n });\n\n describe('multiple nested directories with app delegate', () => {\n it('should return the first one', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n\n const nestedDir = path.join(tempDir, 'nested');\n fs.mkdirSync(nestedDir);\n const nestedFilePath = prepareAppDelegateFile(\n nestedDir,\n validAppDelegateSwift,\n 'swift',\n );\n\n const nestedDir2 = path.join(tempDir, 'nested2');\n fs.mkdirSync(nestedDir2);\n prepareAppDelegateFile(nestedDir2, validAppDelegateSwift, 'swift');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);\n\n // -- Assert --\n expect(result).toBe(nestedFilePath);\n });\n });\n\n describe('no app delegate found', () => {\n it('should return null', () => {\n // -- Arrange --\n const tempDir = fs.mkdtempSync(\n path.join(os.tmpdir(), 'code-tools-test'),\n );\n\n // -- Act --\n const result = exportForTesting.findAppDidFinishLaunchingWithOptions(\n tempDir,\n [],\n );\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n });\n\n describe('#addCodeSnippetToProject', () => {\n describe('app delegate file is not found', () => {\n it('should return false', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n\n // -- Act --\n const result = addCodeSnippetToProject(\n tempDir,\n ['AppDelegate.swift'],\n 'https://example.com/sentry-dsn',\n );\n\n // -- Assert --\n expect(result).toBeFalsy();\n });\n });\n\n describe('app delegate file is found', () => {\n let tempDir: string;\n let appDelegatePath: string;\n\n beforeEach(() => {\n // -- Arrange --\n tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'code-tools-test'));\n appDelegatePath = path.join(tempDir, 'AppDelegate.swift');\n fs.writeFileSync(appDelegatePath, validAppDelegateSwift, 'utf8');\n });\n\n describe('is Swift file', () => {\n describe('Sentry is not initialized', () => {\n let tempDir: string;\n let filePath: string;\n\n beforeEach(() => {\n tempDir = prepareTempDir();\n filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateSwift,\n 'swift',\n );\n });\n\n it('should add the code snippet', () => {\n // -- Act --\n const result = addCodeSnippetToProject(tempDir, [filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n const modifiedFileContent = fs.readFileSync(filePath, 'utf8');\n expect(modifiedFileContent).toBe(validAppDelegateSwiftWithSentry);\n });\n\n it(\"should set tag 'code-language'\", () => {\n // -- Act --\n const result = addCodeSnippetToProject(tempDir, [filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(Sentry.setTag).toHaveBeenCalledWith(\n 'code-language',\n 'swift',\n );\n });\n\n it(\"should set tag 'ui-engine'\", () => {\n // -- Act --\n const result = addCodeSnippetToProject(tempDir, [filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(Sentry.setTag).toHaveBeenCalledWith('ui-engine', 'uikit');\n });\n });\n\n describe('Sentry is already initialized', () => {\n it('should not add the code snippet', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateSwiftWithSentry,\n 'swift',\n );\n\n // -- Act --\n const result = addCodeSnippetToProject(tempDir, [filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n const modifiedFileContent = fs.readFileSync(filePath, 'utf8');\n expect(modifiedFileContent).toBe(validAppDelegateSwiftWithSentry);\n });\n });\n\n describe('is SwiftUI file', () => {\n describe('Sentry is not initialized', () => {\n let tempDir: string;\n let filePath: string;\n\n beforeEach(() => {\n tempDir = prepareTempDir();\n filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateSwiftUI,\n 'swift',\n );\n });\n\n it('should add the code snippet', () => {\n // -- Act --\n const result = addCodeSnippetToProject(tempDir, [filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n const modifiedFileContent = fs.readFileSync(filePath, 'utf8');\n expect(modifiedFileContent).toBe(\n validAppDelegateSwiftUIWithSentry,\n );\n });\n\n it(\"should set tag 'code-language'\", () => {\n // -- Act --\n const result = addCodeSnippetToProject(tempDir, [filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(Sentry.setTag).toHaveBeenNthCalledWith(\n 1,\n 'code-language',\n 'swift',\n );\n });\n\n it(\"should set tag 'ui-engine'\", () => {\n // -- Act --\n const result = addCodeSnippetToProject(tempDir, [filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(Sentry.setTag).toHaveBeenNthCalledWith(\n 2,\n 'ui-engine',\n 'swiftui',\n );\n });\n });\n\n describe('Sentry is already initialized', () => {\n it('should not add the code snippet', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateSwiftUIWithSentry,\n 'swift',\n );\n\n // -- Act --\n const result = addCodeSnippetToProject(tempDir, [filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n const modifiedFileContent = fs.readFileSync(filePath, 'utf8');\n expect(modifiedFileContent).toBe(\n validAppDelegateSwiftUIWithSentry,\n );\n });\n });\n });\n\n describe('is not matching SwiftUI regex', () => {\n it('should not add the code snippet', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n invalidAppDelegateSwiftUI,\n 'swift',\n );\n\n // -- Act --\n const result = addCodeSnippetToProject(tempDir, [filePath], dsn);\n\n // -- Assert --\n expect(result).toBeFalsy();\n });\n });\n });\n\n describe('is Objective-C file', () => {\n describe('Sentry is not initialized', () => {\n it('should add the code snippet', () => {\n // -- Act --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateObjC,\n 'm',\n );\n\n // -- Act --\n const result = addCodeSnippetToProject(tempDir, [filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n const modifiedFileContent = fs.readFileSync(filePath, 'utf8');\n expect(modifiedFileContent).toBe(validAppDelegateObjCWithSentry);\n });\n });\n\n describe('Sentry is already initialized', () => {\n let tempDir: string;\n let filePath: string;\n\n beforeEach(() => {\n tempDir = prepareTempDir();\n filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateObjCWithSentry,\n 'm',\n );\n });\n\n it('should not add the code snippet', () => {\n // -- Act --\n const result = addCodeSnippetToProject(tempDir, [filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n const modifiedFileContent = fs.readFileSync(filePath, 'utf8');\n expect(modifiedFileContent).toBe(validAppDelegateObjCWithSentry);\n });\n\n it('should log info', () => {\n // -- Act --\n const result = addCodeSnippetToProject(tempDir, [filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(clack.log.info).toHaveBeenCalledWith(\n 'Sentry is already initialized in your AppDelegate. Skipping adding the code snippet.',\n );\n });\n });\n\n it(\"should set tag 'code-language'\", () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateObjC,\n 'm',\n );\n\n // -- Act --\n const result = addCodeSnippetToProject(tempDir, [filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(Sentry.setTag).toHaveBeenCalledWith('code-language', 'objc');\n });\n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sF,CACvF,CAAC;oBACJ,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;gBAEH,IAAA,WAAE,EAAC,gCAAgC,EAAE,GAAG,EAAE;oBACxC,gBAAgB;oBAChB,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;oBACjC,MAAM,QAAQ,GAAG,sBAAsB,CACrC,OAAO,EACP,oBAAoB,EACpB,GAAG,CACJ,CAAC;oBAEF,YAAY;oBACZ,MAAM,MAAM,GAAG,IAAA,oCAAuB,EAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC;oBAExD,eAAe;oBACf,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC;oBAC5B,IAAA,eAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,oBAAoB,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;gBACtE,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as Sentry from '@sentry/node';\nimport * as fs from 'fs';\nimport * as os from 'os';\nimport * as path from 'path';\nimport {\n addCodeSnippetToProject,\n exportForTesting,\n} from '../../src/apple/code-tools';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';\n\n// Test Constants\nconst invalidAppDelegateSwift = `func application() {}`;\nconst validAppDelegateSwift = `\nimport UIKit\n\n@main\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {\n // Override point for customization after application launch.\n return true\n }\n}`;\nconst validAppDelegateSwiftWithSentry = `\nimport UIKit\nimport Sentry\n\n\n@main\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {\n SentrySDK.start { options in\n options.dsn = \"https://example.com/sentry-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 // Override point for customization after application launch.\n return true\n }\n}`;\nconst invalidAppDelegateObjC = `\n- (BOOL)application:(UIApplication *) {\n return NO;\n}`;\nconst validAppDelegateObjC = `\n#import \"AppDelegate.h\"\n\n@interface AppDelegate ()\n\n@end\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n // Override point for customization after application launch.\n return YES;\n}\n\n@end`;\nconst validAppDelegateObjCWithSentry = `@import Sentry;\n\n#import \"AppDelegate.h\"\n\n@interface AppDelegate ()\n\n@end\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n [SentrySDK startWithConfigureOptions:^(SentryOptions * options) {\n options.dsn = @\"https://example.com/sentry-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 // Override point for customization after application launch.\n return YES;\n}\n\n@end`;\nconst invalidAppDelegateSwiftUI = `\nstruct MyApp: App {\n var body: some Scene {\n WindowGroup { Text(\"Hello, world!\") }\n }\n}`;\nconst validAppDelegateSwiftUI = `\nimport SwiftUI\n\n@main\nstruct TestApp: App {\n var body: some Scene {\n WindowGroup {\n ContentView()\n }\n }\n}`;\nconst validAppDelegateSwiftUIWithSentry = `\nimport SwiftUI\nimport Sentry\n\n\n@main\nstruct TestApp: App {\n init() {\n SentrySDK.start { options in\n options.dsn = \"https://example.com/sentry-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 var body: some Scene {\n WindowGroup {\n ContentView()\n }\n }\n}`;\n\nconst prepareTempDir = (): string => {\n const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'code-tools-test'));\n return tempDir;\n};\n\nconst prepareAppDelegateFile = (\n dir: string,\n content: string,\n ext: 'm' | 'mm' | 'swift',\n): string => {\n const filePath = path.join(dir, `AppDelegate.${ext}`);\n fs.writeFileSync(filePath, content, 'utf8');\n return filePath;\n};\n\nconst dsn = 'https://example.com/sentry-dsn';\n\n// Mock Setup\n\nvi.mock('../../src/utils/bash');\nvi.spyOn(Sentry, 'setTag').mockImplementation(() => undefined);\nvi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');\n\n// Test Suite\n\ndescribe('code-tools', () => {\n beforeEach(() => {\n vi.spyOn(clack.log, 'info').mockImplementation(() => undefined);\n });\n\n afterEach(() => {\n vi.clearAllMocks();\n });\n\n describe('#isAppDelegateFile', () => {\n const prepareTestFile = (\n content: string,\n ext: 'm' | 'mm' | 'swift',\n ): string => {\n const tempDir = prepareTempDir();\n return prepareAppDelegateFile(tempDir, content, ext);\n };\n\n describe('swift files', () => {\n describe('swift app launch regex', () => {\n describe('valid cases', () => {\n const variations: {\n name: string;\n code: string;\n }[] = [\n {\n name: 'with underscores',\n code: 'func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {',\n },\n {\n name: 'with different dictionary type',\n code: 'func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {',\n },\n {\n name: 'with extra whitespace',\n code: ' func application ( _ application: UIApplication , didFinishLaunchingWithOptions launchOptions: [ NSObject : AnyObject ]? ) -> Bool { ',\n },\n {\n name: 'macOS notification variant',\n code: 'func applicationDidFinishLaunching(_ aNotification: Notification) {',\n },\n {\n name: 'macOS with extra whitespace',\n code: 'func applicationDidFinishLaunching ( _ aNotification: Notification ) {',\n },\n ];\n\n for (const variation of variations) {\n describe(`${variation.name}`, () => {\n it(`should return true`, () => {\n // -- Arrange --\n const filePath = prepareTestFile(variation.code, 'swift');\n\n // -- Act --\n const result = exportForTesting.isAppDelegateFile(filePath);\n\n // -- Assert --\n expect(result).toBeTruthy();\n });\n });\n }\n\n describe('invalid cases', () => {\n const variations: {\n name: string;\n code: string;\n }[] = [\n {\n name: 'missing application method',\n code: 'import UIKit',\n },\n {\n name: 'typo in method name',\n code: 'func applicatioM(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {',\n },\n {\n name: 'garbage input',\n code: 'asdf;jk23;uas()d{',\n },\n ];\n\n for (const variation of variations) {\n describe(`${variation.name}`, () => {\n it('should return false', () => {\n // -- Arrange --\n const filePath = prepareTestFile(variation.code, 'swift');\n\n // -- Act --\n const result = exportForTesting.isAppDelegateFile(filePath);\n\n // -- Assert --\n expect(result).toBeFalsy();\n });\n });\n }\n });\n });\n });\n });\n\n describe('objc files', () => {\n describe('valid cases', () => {\n const variations: {\n name: string;\n code: string;\n }[] = [\n {\n name: 'basic',\n code: '- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {',\n },\n {\n name: 'with more whitespace',\n code: '- ( BOOL ) application: ( UIApplication * ) application didFinishLaunchingWithOptions: ( NSDictionary * ) launchOptions {',\n },\n ];\n\n for (const variation of variations) {\n describe(`${variation.name}`, () => {\n it('should return true', () => {\n // -- Arrange --\n const filePath = prepareTestFile(variation.code, 'm');\n\n // -- Act --\n const result = exportForTesting.isAppDelegateFile(filePath);\n\n // -- Assert --\n expect(result).toBeTruthy();\n });\n });\n }\n });\n\n describe('invalid cases', () => {\n const variations: {\n name: string;\n code: string;\n }[] = [\n {\n name: 'missing application method',\n code: 'import UIKit',\n },\n ];\n\n for (const variation of variations) {\n describe(`${variation.name}`, () => {\n it('should return false', () => {\n // -- Arrange --\n const filePath = prepareTestFile(variation.code, 'm');\n\n // -- Act --\n const result = exportForTesting.isAppDelegateFile(filePath);\n\n // -- Assert --\n expect(result).toBeFalsy();\n });\n });\n }\n });\n });\n\n describe('swiftui files', () => {\n describe('valid cases', () => {\n const variations: {\n name: string;\n code: string;\n }[] = [\n {\n name: 'basic',\n code: '@main struct MyApp: App {',\n },\n {\n name: 'with more whitespace',\n code: '@main struct MyApp: App {',\n },\n {\n name: 'with SwiftUI namespace',\n code: '@main struct App: SwiftUI.App {',\n },\n ];\n\n for (const variation of variations) {\n describe(`${variation.name}`, () => {\n it('should return true', () => {\n // -- Arrange --\n const filePath = prepareTestFile(variation.code, 'swift');\n\n // -- Act --\n const result = exportForTesting.isAppDelegateFile(filePath);\n\n // -- Assert --\n expect(result).toBeTruthy();\n });\n });\n }\n });\n\n describe('invalid cases', () => {\n const variations: {\n name: string;\n code: string;\n }[] = [\n {\n name: 'missing @main',\n code: 'struct App: App {',\n },\n {\n name: 'missing super-type App',\n code: 'struct MyApp {',\n },\n {\n name: 'imported not from SwiftUI',\n code: '@main struct App: MySwiftyUI.App {',\n },\n {\n name: 'imported not from SwiftUI but similar',\n code: '@main struct App: MySwiftUI.App {',\n },\n ];\n\n for (const variation of variations) {\n describe(`${variation.name}`, () => {\n it('should return false', () => {\n // -- Arrange --\n const filePath = prepareTestFile(variation.code, 'swift');\n\n // -- Act --\n const result = exportForTesting.isAppDelegateFile(filePath);\n\n // -- Assert --\n expect(result).toBeFalsy();\n });\n });\n }\n });\n });\n\n describe('file not found', () => {\n it('should throw an error', () => {\n // -- Arrange --\n const invalidPath = path.join(os.tmpdir(), 'invalid-path');\n\n // -- Act & Assert --\n expect(() => exportForTesting.isAppDelegateFile(invalidPath)).toThrow();\n });\n });\n });\n\n describe('#findAppDidFinishLaunchingWithOptionsInDirectory', () => {\n describe('no files given', () => {\n it('should check files in directory', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateSwift,\n 'swift',\n );\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(\n tempDir,\n );\n\n // -- Assert --\n expect(result).toBe(filePath);\n });\n });\n\n describe('SwiftUI file found', () => {\n describe('is app delegate', () => {\n it('should return the file path', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateSwiftUI,\n 'swift',\n );\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(\n tempDir,\n );\n\n // -- Assert --\n expect(result).toBe(filePath);\n });\n });\n\n describe('is not app delegate', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n prepareAppDelegateFile(tempDir, invalidAppDelegateSwiftUI, 'swift');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(\n tempDir,\n );\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n });\n\n describe('Swift file found', () => {\n describe('is app delegate', () => {\n it('should return the file path', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateSwift,\n 'swift',\n );\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(\n tempDir,\n );\n\n // -- Assert --\n expect(result).toBe(filePath);\n });\n });\n\n describe('is not app delegate', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n prepareAppDelegateFile(tempDir, invalidAppDelegateSwift, 'swift');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(\n tempDir,\n );\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n });\n\n describe('Objective-C file found', () => {\n describe('is app delegate', () => {\n it('should return the file path', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateObjC,\n 'm',\n );\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(\n tempDir,\n );\n\n // -- Assert --\n expect(result).toBe(filePath);\n });\n });\n\n describe('is not app delegate', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n prepareAppDelegateFile(tempDir, invalidAppDelegateObjC, 'm');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(\n tempDir,\n );\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n });\n\n describe('Objective-C++ file found', () => {\n describe('is app delegate', () => {\n it('should return the file path', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateObjC,\n 'mm',\n );\n\n // -- Act --\n const result = exportForTesting.findAppDidFinishLaunchingWithOptions([\n filePath,\n ]);\n\n // -- Assert --\n expect(result).toBe(filePath);\n });\n });\n\n describe('is not app delegate', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n prepareAppDelegateFile(tempDir, invalidAppDelegateObjC, 'mm');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(\n tempDir,\n );\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n });\n\n describe('file in list not found', () => {\n it('should return null', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n invalidAppDelegateSwift,\n 'swift',\n );\n\n // -- Act --\n const result = exportForTesting.findAppDidFinishLaunchingWithOptions([\n filePath,\n ]);\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n\n describe('unrelated file found', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n invalidAppDelegateSwift,\n 'swift',\n );\n\n // -- Act --\n const result = exportForTesting.findAppDidFinishLaunchingWithOptions([\n filePath,\n ]);\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n\n describe('directory in list', () => {\n describe('name starts with dot', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n\n const hiddenDir = path.join(tempDir, '.hidden');\n fs.mkdirSync(hiddenDir);\n\n prepareAppDelegateFile(hiddenDir, validAppDelegateSwift, 'swift');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(\n tempDir,\n );\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n\n describe('name ends with .xcodeproj', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const xcodeDir = path.join(tempDir, 'MyProject.xcodeproj');\n fs.mkdirSync(xcodeDir);\n\n prepareAppDelegateFile(xcodeDir, validAppDelegateSwift, 'swift');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(\n tempDir,\n );\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n\n describe('name ends with .xcassets', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const xcassetsDir = path.join(tempDir, 'MyProject.xcassets');\n fs.mkdirSync(xcassetsDir);\n\n prepareAppDelegateFile(xcassetsDir, validAppDelegateSwift, 'swift');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(\n tempDir,\n );\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n\n describe('is not a directory', () => {\n it('should be ignored', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = path.join(tempDir, 'some-file');\n fs.writeFileSync(filePath, validAppDelegateSwift, 'utf8');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(\n tempDir,\n );\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n });\n\n describe('multiple files could be app delegate', () => {\n it('should return the first one', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateSwift,\n 'swift',\n );\n prepareAppDelegateFile(tempDir, validAppDelegateSwift, 'swift');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(\n tempDir,\n );\n\n // -- Assert --\n expect(result).toBe(filePath);\n });\n });\n\n describe('multiple nested directories with app delegate', () => {\n it('should return the first one', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n\n const nestedDir = path.join(tempDir, 'nested');\n fs.mkdirSync(nestedDir);\n const nestedFilePath = prepareAppDelegateFile(\n nestedDir,\n validAppDelegateSwift,\n 'swift',\n );\n\n const nestedDir2 = path.join(tempDir, 'nested2');\n fs.mkdirSync(nestedDir2);\n prepareAppDelegateFile(nestedDir2, validAppDelegateSwift, 'swift');\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(\n tempDir,\n );\n\n // -- Assert --\n expect(result).toBe(nestedFilePath);\n });\n });\n\n describe('no app delegate found', () => {\n it('should return null', () => {\n // -- Arrange --\n const tempDir = fs.mkdtempSync(\n path.join(os.tmpdir(), 'code-tools-test'),\n );\n\n // -- Act --\n const result =\n exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(\n tempDir,\n );\n\n // -- Assert --\n expect(result).toBeNull();\n });\n });\n });\n\n describe('#addCodeSnippetToProject', () => {\n describe('app delegate file is not found', () => {\n it('should return false', () => {\n // -- Act --\n const result = addCodeSnippetToProject(\n ['AppDelegate.swift'],\n 'https://example.com/sentry-dsn',\n );\n\n // -- Assert --\n expect(result).toBeFalsy();\n });\n });\n\n describe('app delegate file is found', () => {\n let tempDir: string;\n let appDelegatePath: string;\n\n beforeEach(() => {\n // -- Arrange --\n tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'code-tools-test'));\n appDelegatePath = path.join(tempDir, 'AppDelegate.swift');\n fs.writeFileSync(appDelegatePath, validAppDelegateSwift, 'utf8');\n });\n\n describe('is Swift file', () => {\n describe('Sentry is not initialized', () => {\n let tempDir: string;\n let filePath: string;\n\n beforeEach(() => {\n tempDir = prepareTempDir();\n filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateSwift,\n 'swift',\n );\n });\n\n it('should add the code snippet', () => {\n // -- Act --\n const result = addCodeSnippetToProject([filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n const modifiedFileContent = fs.readFileSync(filePath, 'utf8');\n expect(modifiedFileContent).toBe(validAppDelegateSwiftWithSentry);\n });\n\n it(\"should set tag 'code-language'\", () => {\n // -- Act --\n const result = addCodeSnippetToProject([filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(Sentry.setTag).toHaveBeenCalledWith(\n 'code-language',\n 'swift',\n );\n });\n\n it(\"should set tag 'ui-engine'\", () => {\n // -- Act --\n const result = addCodeSnippetToProject([filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(Sentry.setTag).toHaveBeenCalledWith('ui-engine', 'uikit');\n });\n });\n\n describe('Sentry is already initialized', () => {\n it('should not add the code snippet', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateSwiftWithSentry,\n 'swift',\n );\n\n // -- Act --\n const result = addCodeSnippetToProject([filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n const modifiedFileContent = fs.readFileSync(filePath, 'utf8');\n expect(modifiedFileContent).toBe(validAppDelegateSwiftWithSentry);\n });\n });\n\n describe('is SwiftUI file', () => {\n describe('Sentry is not initialized', () => {\n let tempDir: string;\n let filePath: string;\n\n beforeEach(() => {\n tempDir = prepareTempDir();\n filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateSwiftUI,\n 'swift',\n );\n });\n\n it('should add the code snippet', () => {\n // -- Act --\n const result = addCodeSnippetToProject([filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n const modifiedFileContent = fs.readFileSync(filePath, 'utf8');\n expect(modifiedFileContent).toBe(\n validAppDelegateSwiftUIWithSentry,\n );\n });\n\n it(\"should set tag 'code-language'\", () => {\n // -- Act --\n const result = addCodeSnippetToProject([filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(Sentry.setTag).toHaveBeenNthCalledWith(\n 1,\n 'code-language',\n 'swift',\n );\n });\n\n it(\"should set tag 'ui-engine'\", () => {\n // -- Act --\n const result = addCodeSnippetToProject([filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(Sentry.setTag).toHaveBeenNthCalledWith(\n 2,\n 'ui-engine',\n 'swiftui',\n );\n });\n });\n\n describe('Sentry is already initialized', () => {\n it('should not add the code snippet', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateSwiftUIWithSentry,\n 'swift',\n );\n\n // -- Act --\n const result = addCodeSnippetToProject([filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n const modifiedFileContent = fs.readFileSync(filePath, 'utf8');\n expect(modifiedFileContent).toBe(\n validAppDelegateSwiftUIWithSentry,\n );\n });\n });\n });\n\n describe('is not matching SwiftUI regex', () => {\n it('should not add the code snippet', () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n invalidAppDelegateSwiftUI,\n 'swift',\n );\n\n // -- Act --\n const result = addCodeSnippetToProject([filePath], dsn);\n\n // -- Assert --\n expect(result).toBeFalsy();\n });\n });\n });\n\n describe('is Objective-C file', () => {\n describe('Sentry is not initialized', () => {\n it('should add the code snippet', () => {\n // -- Act --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateObjC,\n 'm',\n );\n\n // -- Act --\n const result = addCodeSnippetToProject([filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n const modifiedFileContent = fs.readFileSync(filePath, 'utf8');\n expect(modifiedFileContent).toBe(validAppDelegateObjCWithSentry);\n });\n });\n\n describe('Sentry is already initialized', () => {\n let tempDir: string;\n let filePath: string;\n\n beforeEach(() => {\n tempDir = prepareTempDir();\n filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateObjCWithSentry,\n 'm',\n );\n });\n\n it('should not add the code snippet', () => {\n // -- Act --\n const result = addCodeSnippetToProject([filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n const modifiedFileContent = fs.readFileSync(filePath, 'utf8');\n expect(modifiedFileContent).toBe(validAppDelegateObjCWithSentry);\n });\n\n it('should log info', () => {\n // -- Act --\n const result = addCodeSnippetToProject([filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(clack.log.info).toHaveBeenCalledWith(\n 'Sentry is already initialized in your AppDelegate. Skipping adding the code snippet.',\n );\n });\n });\n\n it(\"should set tag 'code-language'\", () => {\n // -- Arrange --\n const tempDir = prepareTempDir();\n const filePath = prepareAppDelegateFile(\n tempDir,\n validAppDelegateObjC,\n 'm',\n );\n\n // -- Act --\n const result = addCodeSnippetToProject([filePath], dsn);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(Sentry.setTag).toHaveBeenCalledWith('code-language', 'objc');\n });\n });\n });\n });\n});\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ // @ts-expect-error - clack is ESM and TS complains about that. It works though
30
+ const clack = __importStar(require("@clack/prompts"));
31
+ const fs = __importStar(require("node:fs"));
32
+ const os = __importStar(require("node:os"));
33
+ const node_path_1 = __importDefault(require("node:path"));
34
+ const vitest_1 = require("vitest");
35
+ const configure_sentry_cli_1 = require("../../src/apple/configure-sentry-cli");
36
+ vitest_1.vi.mock('@clack/prompts', async () => ({
37
+ __esModule: true,
38
+ default: await vitest_1.vi.importActual('@clack/prompts'),
39
+ }));
40
+ (0, vitest_1.describe)('configureSentryCLI', () => {
41
+ const authToken = 'test';
42
+ let projectDir;
43
+ let rcPath;
44
+ let gitignorePath;
45
+ (0, vitest_1.beforeEach)(() => {
46
+ (0, vitest_1.beforeEach)(() => {
47
+ vitest_1.vi.spyOn(clack.log, 'warn').mockImplementation(() => {
48
+ /* empty */
49
+ });
50
+ vitest_1.vi.spyOn(clack, 'select').mockResolvedValue(undefined);
51
+ });
52
+ projectDir = fs.mkdtempSync(node_path_1.default.join(os.tmpdir(), 'project'));
53
+ fs.mkdirSync(projectDir, { recursive: true });
54
+ rcPath = node_path_1.default.join(projectDir, '.sentryclirc');
55
+ gitignorePath = node_path_1.default.join(projectDir, '.gitignore');
56
+ });
57
+ (0, vitest_1.describe)('.sentryclirc file not exists', () => {
58
+ (0, vitest_1.it)('should create the .sentryclirc file', () => {
59
+ // -- Arrange --
60
+ // Pre-condition is that the .sentryclirc file does not exist
61
+ (0, vitest_1.expect)(fs.existsSync(rcPath)).toBe(false);
62
+ // -- Act --
63
+ (0, configure_sentry_cli_1.configureSentryCLI)({ projectDir, authToken });
64
+ // -- Assert --
65
+ (0, vitest_1.expect)(fs.existsSync(rcPath)).toBe(true);
66
+ (0, vitest_1.expect)(fs.readFileSync(rcPath, 'utf8')).toContain(`token=test`);
67
+ });
68
+ });
69
+ (0, vitest_1.describe)('.sentryclirc file exists', () => {
70
+ (0, vitest_1.it)('should update the .sentryclirc file', () => {
71
+ // -- Arrange --
72
+ // Pre-condition is that the .sentryclirc file exists
73
+ fs.writeFileSync(rcPath, `token=old`);
74
+ // -- Act --
75
+ (0, configure_sentry_cli_1.configureSentryCLI)({ projectDir, authToken });
76
+ // -- Assert --
77
+ (0, vitest_1.expect)(fs.readFileSync(rcPath, 'utf8')).toContain(`token=${authToken}`);
78
+ });
79
+ });
80
+ (0, vitest_1.describe)('.gitignore file not exists', () => {
81
+ (0, vitest_1.it)('should create the .gitignore file', () => {
82
+ // -- Arrange --
83
+ // Pre-condition is that the .gitignore file does not exist
84
+ (0, vitest_1.expect)(fs.existsSync(gitignorePath)).toBe(false);
85
+ // -- Act --
86
+ (0, configure_sentry_cli_1.configureSentryCLI)({ projectDir, authToken });
87
+ // -- Assert --
88
+ (0, vitest_1.expect)(fs.existsSync(gitignorePath)).toBe(true);
89
+ (0, vitest_1.expect)(fs.readFileSync(gitignorePath, 'utf8')).toContain('.sentryclirc');
90
+ });
91
+ });
92
+ (0, vitest_1.describe)('.gitignore file exists', () => {
93
+ (0, vitest_1.describe)("contains '.sentryclirc'", () => {
94
+ (0, vitest_1.it)('should not append the .sentryclirc file to the .gitignore file', () => {
95
+ // -- Arrange --
96
+ // Pre-condition is that the .gitignore file exists and contains '.sentryclirc'
97
+ fs.writeFileSync(gitignorePath, `
98
+ # Xcode
99
+ xcuserdata/
100
+
101
+ # Sentry
102
+ .sentryclirc
103
+ `);
104
+ // -- Act --
105
+ (0, configure_sentry_cli_1.configureSentryCLI)({ projectDir, authToken });
106
+ // -- Assert --
107
+ (0, vitest_1.expect)(fs.readFileSync(gitignorePath, 'utf8')).toContain('.sentryclirc');
108
+ });
109
+ });
110
+ (0, vitest_1.describe)("does not contain '.sentryclirc'", () => {
111
+ (0, vitest_1.it)('should append the .sentryclirc file to the .gitignore file', () => {
112
+ // -- Arrange --
113
+ // Pre-condition is that the .gitignore file exists and does not contain '.sentryclirc'
114
+ fs.writeFileSync(gitignorePath, `
115
+ # Xcode
116
+ xcuserdata/
117
+ `);
118
+ // -- Act --
119
+ (0, configure_sentry_cli_1.configureSentryCLI)({ projectDir, authToken });
120
+ // -- Assert --
121
+ (0, vitest_1.expect)(fs.readFileSync(gitignorePath, 'utf8')).toBe(`
122
+ # Xcode
123
+ xcuserdata/
124
+
125
+ .sentryclirc
126
+ `);
127
+ });
128
+ });
129
+ });
130
+ });
131
+ //# sourceMappingURL=configure-sentry-cli.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure-sentry-cli.test.js","sourceRoot":"","sources":["../../../test/apple/configure-sentry-cli.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,sDAAwC;AACxC,4CAA8B;AAC9B,4CAA8B;AAC9B,0DAA6B;AAC7B,mCAA8D;AAC9D,+EAA0E;AAE1E,WAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IACrC,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,MAAM,WAAE,CAAC,YAAY,CAAe,gBAAgB,CAAC;CAC/D,CAAC,CAAC,CAAC;AAEJ,IAAA,iBAAQ,EAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,MAAM,SAAS,GAAG,MAAM,CAAC;IACzB,IAAI,UAAkB,CAAC;IACvB,IAAI,MAAc,CAAC;IACnB,IAAI,aAAqB,CAAC;IAE1B,IAAA,mBAAU,EAAC,GAAG,EAAE;QACd,IAAA,mBAAU,EAAC,GAAG,EAAE;YACd,WAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE;gBAClD,WAA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,EAAC,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC;gBAE9C,eAAe;gBACf,IAAA,eAAM,EAAC,EAAE,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CACtD,cAAc,CACf,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAA,iBAAQ,EAAC,iCAAiC,EAAE,GAAG,EAAE;YAC/C,IAAA,WAAE,EAAC,4DAA4D,EAAE,GAAG,EAAE;gBACpE,gBAAgB;gBAChB,uFAAuF;gBACvF,EAAE,CAAC,aAAa,CACd,aAAa,EACb;;;CAGT,CACQ,CAAC;gBAEF,YAAY;gBACZ,IAAA,yCAAkB,EAAC,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC;gBAE9C,eAAe;gBACf,IAAA,eAAM,EAAC,EAAE,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CACjD;;;;;CAKT,CACQ,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as fs from 'node:fs';\nimport * as os from 'node:os';\nimport path from 'node:path';\nimport { beforeEach, describe, expect, it, vi } from 'vitest';\nimport { configureSentryCLI } from '../../src/apple/configure-sentry-cli';\n\nvi.mock('@clack/prompts', async () => ({\n __esModule: true,\n default: await vi.importActual<typeof clack>('@clack/prompts'),\n}));\n\ndescribe('configureSentryCLI', () => {\n const authToken = 'test';\n let projectDir: string;\n let rcPath: string;\n let gitignorePath: string;\n\n beforeEach(() => {\n beforeEach(() => {\n vi.spyOn(clack.log, 'warn').mockImplementation(() => {\n /* empty */\n });\n vi.spyOn(clack, 'select').mockResolvedValue(undefined);\n });\n\n projectDir = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));\n fs.mkdirSync(projectDir, { recursive: true });\n\n rcPath = path.join(projectDir, '.sentryclirc');\n gitignorePath = path.join(projectDir, '.gitignore');\n });\n\n describe('.sentryclirc file not exists', () => {\n it('should create the .sentryclirc file', () => {\n // -- Arrange --\n // Pre-condition is that the .sentryclirc file does not exist\n expect(fs.existsSync(rcPath)).toBe(false);\n\n // -- Act --\n configureSentryCLI({ projectDir, authToken });\n\n // -- Assert --\n expect(fs.existsSync(rcPath)).toBe(true);\n expect(fs.readFileSync(rcPath, 'utf8')).toContain(`token=test`);\n });\n });\n\n describe('.sentryclirc file exists', () => {\n it('should update the .sentryclirc file', () => {\n // -- Arrange --\n // Pre-condition is that the .sentryclirc file exists\n fs.writeFileSync(rcPath, `token=old`);\n\n // -- Act --\n configureSentryCLI({ projectDir, authToken });\n\n // -- Assert --\n expect(fs.readFileSync(rcPath, 'utf8')).toContain(`token=${authToken}`);\n });\n });\n\n describe('.gitignore file not exists', () => {\n it('should create the .gitignore file', () => {\n // -- Arrange --\n // Pre-condition is that the .gitignore file does not exist\n expect(fs.existsSync(gitignorePath)).toBe(false);\n\n // -- Act --\n configureSentryCLI({ projectDir, authToken });\n\n // -- Assert --\n expect(fs.existsSync(gitignorePath)).toBe(true);\n expect(fs.readFileSync(gitignorePath, 'utf8')).toContain('.sentryclirc');\n });\n });\n\n describe('.gitignore file exists', () => {\n describe(\"contains '.sentryclirc'\", () => {\n it('should not append the .sentryclirc file to the .gitignore file', () => {\n // -- Arrange --\n // Pre-condition is that the .gitignore file exists and contains '.sentryclirc'\n fs.writeFileSync(\n gitignorePath,\n `\n# Xcode\nxcuserdata/\n\n# Sentry\n.sentryclirc\n`,\n );\n\n // -- Act --\n configureSentryCLI({ projectDir, authToken });\n\n // -- Assert --\n expect(fs.readFileSync(gitignorePath, 'utf8')).toContain(\n '.sentryclirc',\n );\n });\n });\n\n describe(\"does not contain '.sentryclirc'\", () => {\n it('should append the .sentryclirc file to the .gitignore file', () => {\n // -- Arrange --\n // Pre-condition is that the .gitignore file exists and does not contain '.sentryclirc'\n fs.writeFileSync(\n gitignorePath,\n `\n# Xcode\nxcuserdata/\n`,\n );\n\n // -- Act --\n configureSentryCLI({ projectDir, authToken });\n\n // -- Assert --\n expect(fs.readFileSync(gitignorePath, 'utf8')).toBe(\n `\n# Xcode\nxcuserdata/\n\n.sentryclirc\n`,\n );\n });\n });\n });\n});\n"]}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ // Note for future maintainers:
3
+ //
4
+ // This test file is mocking the `child_process` module.
5
+ // As other tests are using the `child_process` module, we can not have them in the same file.
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const vitest_1 = require("vitest");
8
+ const macos_system_helper_1 = require("../../src/apple/macos-system-helper");
9
+ const { execSyncMock } = vitest_1.vi.hoisted(() => {
10
+ return {
11
+ execSyncMock: vitest_1.vi.fn(),
12
+ };
13
+ });
14
+ vitest_1.vi.mock('node:child_process', async () => {
15
+ return {
16
+ ...(await vitest_1.vi.importActual('node:child_process')),
17
+ execSync: execSyncMock,
18
+ };
19
+ });
20
+ (0, vitest_1.describe)('MacOSSystemHelpers', () => {
21
+ (0, vitest_1.afterEach)(() => {
22
+ vitest_1.vi.clearAllMocks();
23
+ vitest_1.vi.restoreAllMocks();
24
+ });
25
+ (0, vitest_1.describe)('readXcodeBuildSettings', () => {
26
+ (0, vitest_1.describe)('project path', () => {
27
+ (0, vitest_1.it)('should escape quotes', () => {
28
+ // -- Arrange --
29
+ const projectPath = 'some path" && echo "Hello World"';
30
+ // Use spyOn instead of vi.mock
31
+ execSyncMock.mockImplementationOnce(() => {
32
+ return ' ACTION = build';
33
+ });
34
+ // -- Act --
35
+ const buildSettings = macos_system_helper_1.MacOSSystemHelpers.readXcodeBuildSettings(projectPath);
36
+ // -- Assert --
37
+ (0, vitest_1.expect)(buildSettings).toEqual({
38
+ ACTION: 'build',
39
+ });
40
+ // We expect the project path to be escaped
41
+ (0, vitest_1.expect)(execSyncMock).toHaveBeenCalledWith(`"xcodebuild" "-project" "some path\\" && echo \\"Hello World\\"" "-showBuildSettings"`, { encoding: 'utf8' });
42
+ });
43
+ });
44
+ });
45
+ });
46
+ //# sourceMappingURL=macos-system-helper-mocked.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"macos-system-helper-mocked.test.js","sourceRoot":"","sources":["../../../test/apple/macos-system-helper-mocked.test.ts"],"names":[],"mappings":";AAAA,+BAA+B;AAC/B,EAAE;AACF,wDAAwD;AACxD,8FAA8F;;AAE9F,mCAA6D;AAC7D,6EAAyE;AAEzE,MAAM,EAAE,YAAY,EAAE,GAAG,WAAE,CAAC,OAAO,CAAC,GAAG,EAAE;IACvC,OAAO;QACL,YAAY,EAAE,WAAE,CAAC,EAAE,EAAE;KACtB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,WAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,KAAK,IAAI,EAAE;IACvC,OAAO;QACL,GAAG,CAAC,MAAM,WAAE,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;QAChD,QAAQ,EAAE,YAAY;KACvB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAA,iBAAQ,EAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,IAAA,kBAAS,EAAC,GAAG,EAAE;QACb,WAAE,CAAC,aAAa,EAAE,CAAC;QACnB,WAAE,CAAC,eAAe,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;QACtC,IAAA,iBAAQ,EAAC,cAAc,EAAE,GAAG,EAAE;YAC5B,IAAA,WAAE,EAAC,sBAAsB,EAAE,GAAG,EAAE;gBAC9B,gBAAgB;gBAChB,MAAM,WAAW,GAAG,kCAAkC,CAAC;gBAEvD,+BAA+B;gBAC/B,YAAY,CAAC,sBAAsB,CAAC,GAAG,EAAE;oBACvC,OAAO,mBAAmB,CAAC;gBAC7B,CAAC,CAAC,CAAC;gBAEH,YAAY;gBACZ,MAAM,aAAa,GACjB,wCAAkB,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;gBAEzD,eAAe;gBACf,IAAA,eAAM,EAAC,aAAa,CAAC,CAAC,OAAO,CAAC;oBAC5B,MAAM,EAAE,OAAO;iBAChB,CAAC,CAAC;gBACH,2CAA2C;gBAC3C,IAAA,eAAM,EAAC,YAAY,CAAC,CAAC,oBAAoB,CACvC,uFAAuF,EACvF,EAAE,QAAQ,EAAE,MAAM,EAAE,CACrB,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// Note for future maintainers:\n//\n// This test file is mocking the `child_process` module.\n// As other tests are using the `child_process` module, we can not have them in the same file.\n\nimport { afterEach, describe, expect, it, vi } from 'vitest';\nimport { MacOSSystemHelpers } from '../../src/apple/macos-system-helper';\n\nconst { execSyncMock } = vi.hoisted(() => {\n return {\n execSyncMock: vi.fn(),\n };\n});\n\nvi.mock('node:child_process', async () => {\n return {\n ...(await vi.importActual('node:child_process')),\n execSync: execSyncMock,\n };\n});\n\ndescribe('MacOSSystemHelpers', () => {\n afterEach(() => {\n vi.clearAllMocks();\n vi.restoreAllMocks();\n });\n\n describe('readXcodeBuildSettings', () => {\n describe('project path', () => {\n it('should escape quotes', () => {\n // -- Arrange --\n const projectPath = 'some path\" && echo \"Hello World\"';\n\n // Use spyOn instead of vi.mock\n execSyncMock.mockImplementationOnce(() => {\n return ' ACTION = build';\n });\n\n // -- Act --\n const buildSettings =\n MacOSSystemHelpers.readXcodeBuildSettings(projectPath);\n\n // -- Assert --\n expect(buildSettings).toEqual({\n ACTION: 'build',\n });\n // We expect the project path to be escaped\n expect(execSyncMock).toHaveBeenCalledWith(\n `\"xcodebuild\" \"-project\" \"some path\\\\\" && echo \\\\\"Hello World\\\\\"\" \"-showBuildSettings\"`,\n { encoding: 'utf8' },\n );\n });\n });\n });\n});\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_path_1 = __importDefault(require("node:path"));
7
+ const vitest_1 = require("vitest");
8
+ const macos_system_helper_1 = require("../../src/apple/macos-system-helper");
9
+ const appleProjectsPath = node_path_1.default.resolve(__dirname, '../../fixtures/test-applications/apple');
10
+ const projectWithSynchronizedFolders = node_path_1.default.join(appleProjectsPath, 'xcode-15-compatible-project/Project.xcodeproj');
11
+ // The path to the Xcode.app can be different on different machines, therefore me must detect the path
12
+ // to the Xcode.app using the `xcode-select` command.
13
+ // The same goes for the SDK path, which can be different on different machines depending if the Command Line Tools
14
+ // or the full Xcode is installed.
15
+ //
16
+ // While creating these tests we ensured that the implementation in the tests is correct by comparing.
17
+ // We must not change the implementation in the test code unless we are sure that the implementation is correct!
18
+ (0, vitest_1.describe)('MacOSSystemHelpers', () => {
19
+ (0, vitest_1.afterEach)(() => {
20
+ vitest_1.vi.clearAllMocks();
21
+ vitest_1.vi.restoreAllMocks();
22
+ });
23
+ (0, vitest_1.describe)('findSDKRootDirectoryPath', () => {
24
+ vitest_1.test.runIf(process.platform === 'darwin')('should return the SDK root directory path', () => {
25
+ // -- Act --
26
+ const sdkRootDirectoryPath = macos_system_helper_1.MacOSSystemHelpers.findSDKRootDirectoryPath();
27
+ // -- Assert --
28
+ const candidates = [
29
+ // Matches the path for the Command Line Tools, e.g. /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
30
+ /^\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX\.sdk$/i,
31
+ // Matches the path for the default Xcode.app, e.g. /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
32
+ /^\/Applications\/Xcode\.app\/Contents\/Developer\/Platforms\/MacOSX\.platform\/Developer\/SDKs\/MacOSX\.sdk$/i,
33
+ // Matches the path for any Xcode.app, e.g. /Applications/Xcode-16.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
34
+ /^\/Applications\/Xcode.+\.app\/Contents\/Developer\/Platforms\/MacOSX\.platform\/Developer\/SDKs\/MacOSX\.sdk$/i,
35
+ ];
36
+ (0, vitest_1.expect)(sdkRootDirectoryPath).toSatisfy((path) => candidates.some((regex) => regex.test(path)));
37
+ });
38
+ vitest_1.test.runIf(process.platform !== 'darwin')('should return undefined on non-macOS platforms', () => {
39
+ // The purpose of this test is to verify that the implementation of findSDKRootDirectoryPath() is still unchanged
40
+ // -- Act --
41
+ const sdkRootDirectoryPath = macos_system_helper_1.MacOSSystemHelpers.findSDKRootDirectoryPath();
42
+ // -- Assert --
43
+ (0, vitest_1.expect)(sdkRootDirectoryPath).toBeUndefined();
44
+ });
45
+ });
46
+ (0, vitest_1.describe)('findDeveloperDirectoryPath', () => {
47
+ vitest_1.test.runIf(process.platform === 'darwin')('should return the developer directory path', () => {
48
+ // -- Act --
49
+ const developerDirectoryPath = macos_system_helper_1.MacOSSystemHelpers.findDeveloperDirectoryPath();
50
+ // -- Assert --
51
+ const candidates = [
52
+ // Matches the path for the default Xcode.app, e.g. /Applications/Xcode.app/Contents/Developer
53
+ /^\/Applications\/Xcode\.app\/Contents\/Developer$/i,
54
+ // Matches the path for any Xcode.app, e.g. /Applications/Xcode-16.0.app/Contents/Developer
55
+ /^\/Applications\/Xcode.+\.app\/Contents\/Developer$/i,
56
+ ];
57
+ (0, vitest_1.expect)(developerDirectoryPath).toSatisfy((path) => candidates.some((regex) => regex.test(path)));
58
+ });
59
+ vitest_1.test.runIf(process.platform !== 'darwin')('should return undefined on non-macOS platforms', () => {
60
+ // The purpose of this test is to verify that the implementation of findDeveloperDirectoryPath() is still unchanged
61
+ // -- Act --
62
+ const developerDirectoryPath = macos_system_helper_1.MacOSSystemHelpers.findDeveloperDirectoryPath();
63
+ // -- Assert --
64
+ (0, vitest_1.expect)(developerDirectoryPath).toBeUndefined();
65
+ });
66
+ });
67
+ (0, vitest_1.describe)('readXcodeBuildSettings', () => {
68
+ vitest_1.test.runIf(process.platform === 'darwin')('should return the build settings', () => {
69
+ // -- Act --
70
+ const buildSettings = macos_system_helper_1.MacOSSystemHelpers.readXcodeBuildSettings(projectWithSynchronizedFolders);
71
+ // -- Assert --
72
+ // The build settings are a massive list of key-value pairs, so we'll just check a few of them
73
+ // which are relevant for our use cases.
74
+ (0, vitest_1.expect)(buildSettings?.['CONFIGURATION_BUILD_DIR']).toEqual(node_path_1.default.join(appleProjectsPath, 'xcode-15-compatible-project/build/Release-unknown'));
75
+ (0, vitest_1.expect)(buildSettings?.['TARGET_BUILD_DIR']).toEqual(node_path_1.default.join(appleProjectsPath, 'xcode-15-compatible-project/build/Release-unknown'));
76
+ },
77
+ // Increased timeout to 10 seconds due to timeout errors for Node 18 and Node 20
78
+ 10000);
79
+ vitest_1.test.runIf(process.platform !== 'darwin')('should return undefined on non-macOS platforms', () => {
80
+ // The purpose of this test is to verify that the implementation of readXcodeBuildSettings() is still unchanged
81
+ // -- Act --
82
+ const buildSettings = macos_system_helper_1.MacOSSystemHelpers.readXcodeBuildSettings(projectWithSynchronizedFolders);
83
+ // -- Assert --
84
+ (0, vitest_1.expect)(buildSettings).toBeUndefined();
85
+ });
86
+ });
87
+ });
88
+ //# sourceMappingURL=macos-system-helper.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"macos-system-helper.test.js","sourceRoot":"","sources":["../../../test/apple/macos-system-helper.test.ts"],"names":[],"mappings":";;;;;AAAA,0DAA6B;AAC7B,mCAA+D;AAC/D,6EAAyE;AAEzE,MAAM,iBAAiB,GAAG,mBAAI,CAAC,OAAO,CACpC,SAAS,EACT,wCAAwC,CACzC,CAAC;AACF,MAAM,8BAA8B,GAAG,mBAAI,CAAC,IAAI,CAC9C,iBAAiB,EACjB,+CAA+C,CAChD,CAAC;AAEF,sGAAsG;AACtG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C;YACF,IAAA,eAAM,EAAC,aAAa,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,OAAO,CACjD,mBAAI,CAAC,IAAI,CACP,iBAAiB,EACjB,mDAAmD,CACpD,CACF,CAAC;QACJ,CAAC;QACD,gFAAgF;QAChF,KAAK,CACN,CAAC;QAEF,aAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CACvC,gDAAgD,EAChD,GAAG,EAAE;YACH,+GAA+G;YAE/G,YAAY;YACZ,MAAM,aAAa,GAAG,wCAAkB,CAAC,sBAAsB,CAC7D,8BAA8B,CAC/B,CAAC;YAEF,eAAe;YACf,IAAA,eAAM,EAAC,aAAa,CAAC,CAAC,aAAa,EAAE,CAAC;QACxC,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import path from 'node:path';\nimport { afterEach, describe, expect, test, vi } from 'vitest';\nimport { MacOSSystemHelpers } from '../../src/apple/macos-system-helper';\n\nconst appleProjectsPath = path.resolve(\n __dirname,\n '../../fixtures/test-applications/apple',\n);\nconst projectWithSynchronizedFolders = path.join(\n appleProjectsPath,\n 'xcode-15-compatible-project/Project.xcodeproj',\n);\n\n// The path to the Xcode.app can be different on different machines, therefore me must detect the path\n// to the Xcode.app using the `xcode-select` command.\n// The same goes for the SDK path, which can be different on different machines depending if the Command Line Tools\n// or the full Xcode is installed.\n//\n// While creating these tests we ensured that the implementation in the tests is correct by comparing.\n// We must not change the implementation in the test code unless we are sure that the implementation is correct!\n\ndescribe('MacOSSystemHelpers', () => {\n afterEach(() => {\n vi.clearAllMocks();\n vi.restoreAllMocks();\n });\n\n describe('findSDKRootDirectoryPath', () => {\n test.runIf(process.platform === 'darwin')(\n 'should return the SDK root directory path',\n () => {\n // -- Act --\n const sdkRootDirectoryPath =\n MacOSSystemHelpers.findSDKRootDirectoryPath();\n\n // -- Assert --\n const candidates = [\n // Matches the path for the Command Line Tools, e.g. /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk\n /^\\/Library\\/Developer\\/CommandLineTools\\/SDKs\\/MacOSX\\.sdk$/i,\n // Matches the path for the default Xcode.app, e.g. /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk\n /^\\/Applications\\/Xcode\\.app\\/Contents\\/Developer\\/Platforms\\/MacOSX\\.platform\\/Developer\\/SDKs\\/MacOSX\\.sdk$/i,\n // Matches the path for any Xcode.app, e.g. /Applications/Xcode-16.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk\n /^\\/Applications\\/Xcode.+\\.app\\/Contents\\/Developer\\/Platforms\\/MacOSX\\.platform\\/Developer\\/SDKs\\/MacOSX\\.sdk$/i,\n ];\n\n expect(sdkRootDirectoryPath).toSatisfy((path: string) =>\n candidates.some((regex) => regex.test(path)),\n );\n },\n );\n\n test.runIf(process.platform !== 'darwin')(\n 'should return undefined on non-macOS platforms',\n () => {\n // The purpose of this test is to verify that the implementation of findSDKRootDirectoryPath() is still unchanged\n\n // -- Act --\n const sdkRootDirectoryPath =\n MacOSSystemHelpers.findSDKRootDirectoryPath();\n\n // -- Assert --\n expect(sdkRootDirectoryPath).toBeUndefined();\n },\n );\n });\n\n describe('findDeveloperDirectoryPath', () => {\n test.runIf(process.platform === 'darwin')(\n 'should return the developer directory path',\n () => {\n // -- Act --\n const developerDirectoryPath =\n MacOSSystemHelpers.findDeveloperDirectoryPath();\n\n // -- Assert --\n const candidates = [\n // Matches the path for the default Xcode.app, e.g. /Applications/Xcode.app/Contents/Developer\n /^\\/Applications\\/Xcode\\.app\\/Contents\\/Developer$/i,\n // Matches the path for any Xcode.app, e.g. /Applications/Xcode-16.0.app/Contents/Developer\n /^\\/Applications\\/Xcode.+\\.app\\/Contents\\/Developer$/i,\n ];\n\n expect(developerDirectoryPath).toSatisfy((path: string) =>\n candidates.some((regex) => regex.test(path)),\n );\n },\n );\n test.runIf(process.platform !== 'darwin')(\n 'should return undefined on non-macOS platforms',\n () => {\n // The purpose of this test is to verify that the implementation of findDeveloperDirectoryPath() is still unchanged\n\n // -- Act --\n const developerDirectoryPath =\n MacOSSystemHelpers.findDeveloperDirectoryPath();\n\n // -- Assert --\n expect(developerDirectoryPath).toBeUndefined();\n },\n );\n });\n\n describe('readXcodeBuildSettings', () => {\n test.runIf(process.platform === 'darwin')(\n 'should return the build settings',\n () => {\n // -- Act --\n const buildSettings = MacOSSystemHelpers.readXcodeBuildSettings(\n projectWithSynchronizedFolders,\n );\n\n // -- Assert --\n // The build settings are a massive list of key-value pairs, so we'll just check a few of them\n // which are relevant for our use cases.\n expect(buildSettings?.['CONFIGURATION_BUILD_DIR']).toEqual(\n path.join(\n appleProjectsPath,\n 'xcode-15-compatible-project/build/Release-unknown',\n ),\n );\n expect(buildSettings?.['TARGET_BUILD_DIR']).toEqual(\n path.join(\n appleProjectsPath,\n 'xcode-15-compatible-project/build/Release-unknown',\n ),\n );\n },\n // Increased timeout to 10 seconds due to timeout errors for Node 18 and Node 20\n 10000,\n );\n\n test.runIf(process.platform !== 'darwin')(\n 'should return undefined on non-macOS platforms',\n () => {\n // The purpose of this test is to verify that the implementation of readXcodeBuildSettings() is still unchanged\n\n // -- Act --\n const buildSettings = MacOSSystemHelpers.readXcodeBuildSettings(\n projectWithSynchronizedFolders,\n );\n\n // -- Assert --\n expect(buildSettings).toBeUndefined();\n },\n );\n });\n});\n"]}