@sentry/wizard 4.6.0 → 4.7.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.
- package/CHANGELOG.md +8 -0
- package/dist/bin.js +9 -0
- package/dist/bin.js.map +1 -1
- package/dist/e2e-tests/tests/flutter.test.js +16 -16
- package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
- package/dist/e2e-tests/tests/help-message.test.d.ts +1 -0
- package/dist/e2e-tests/tests/help-message.test.js +56 -0
- package/dist/e2e-tests/tests/help-message.test.js.map +1 -0
- package/dist/e2e-tests/tests/nextjs-14.test.js +15 -15
- package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-15.test.js +15 -15
- package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-3.test.js +13 -12
- package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js +13 -12
- package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
- package/dist/e2e-tests/tests/remix.test.js +20 -20
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit.test.js +20 -20
- package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
- package/dist/e2e-tests/utils/index.js +15 -11
- package/dist/e2e-tests/utils/index.js.map +1 -1
- package/dist/lib/Constants.d.ts +5 -1
- package/dist/lib/Constants.js.map +1 -1
- package/dist/lib/Helper/Logging.d.ts +1 -1
- package/dist/lib/Helper/Logging.js.map +1 -1
- package/dist/lib/Helper/__tests__/File.js +9 -9
- package/dist/lib/Helper/__tests__/File.js.map +1 -1
- package/dist/lib/Helper/__tests__/MergeConfig.js +17 -17
- package/dist/lib/Helper/__tests__/MergeConfig.js.map +1 -1
- package/dist/lib/Helper/__tests__/SentryCli.js +23 -22
- package/dist/lib/Helper/__tests__/SentryCli.js.map +1 -1
- package/dist/lib/Setup.d.ts +2 -1
- package/dist/lib/Setup.js +12 -2
- package/dist/lib/Setup.js.map +1 -1
- package/dist/lib/Steps/BaseStep.d.ts +1 -1
- package/dist/lib/Steps/BaseStep.js.map +1 -1
- package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
- package/dist/lib/Steps/Welcome.js +5 -0
- package/dist/lib/Steps/Welcome.js.map +1 -1
- package/dist/lib/__tests__/Env.js +4 -3
- package/dist/lib/__tests__/Env.js.map +1 -1
- package/dist/src/apple/apple-wizard.js +24 -64
- package/dist/src/apple/apple-wizard.js.map +1 -1
- package/dist/src/apple/configure-package-manager.d.ts +5 -0
- package/dist/src/apple/configure-package-manager.js +68 -0
- package/dist/src/apple/configure-package-manager.js.map +1 -0
- package/dist/src/apple/configure-sentry-cli.d.ts +4 -0
- package/dist/src/apple/configure-sentry-cli.js +47 -0
- package/dist/src/apple/configure-sentry-cli.js.map +1 -0
- package/dist/src/apple/configure-xcode-project.d.ts +8 -0
- package/dist/src/apple/configure-xcode-project.js +11 -0
- package/dist/src/apple/configure-xcode-project.js.map +1 -0
- package/dist/src/apple/inject-code-snippet.d.ts +6 -0
- package/dist/src/apple/inject-code-snippet.js +54 -0
- package/dist/src/apple/inject-code-snippet.js.map +1 -0
- package/dist/src/apple/templates.js +11 -7
- package/dist/src/apple/templates.js.map +1 -1
- package/dist/src/apple/xcode-manager.js +3 -6
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/nextjs/templates.js +3 -1
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/react-native/javascript.d.ts +6 -4
- package/dist/src/react-native/javascript.js +25 -9
- package/dist/src/react-native/javascript.js.map +1 -1
- package/dist/src/react-native/react-native-wizard.d.ts +4 -0
- package/dist/src/react-native/react-native-wizard.js +30 -5
- package/dist/src/react-native/react-native-wizard.js.map +1 -1
- package/dist/src/react-native/xcode.d.ts +7 -3
- package/dist/src/react-native/xcode.js +64 -20
- package/dist/src/react-native/xcode.js.map +1 -1
- package/dist/src/run.js +2 -2
- package/dist/src/run.js.map +1 -1
- package/dist/src/utils/clack/index.js +3 -1
- package/dist/src/utils/clack/index.js.map +1 -1
- package/dist/src/utils/package-manager.d.ts +2 -0
- package/dist/src/utils/package-manager.js +55 -5
- package/dist/src/utils/package-manager.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/android/code-tools.test.js +13 -12
- package/dist/test/android/code-tools.test.js.map +1 -1
- package/dist/test/apple/cocoapod.test.js +77 -72
- package/dist/test/apple/cocoapod.test.js.map +1 -1
- package/dist/test/apple/code-tools.test.js +173 -166
- package/dist/test/apple/code-tools.test.js.map +1 -1
- package/dist/test/apple/fastfile.test.js +86 -83
- package/dist/test/apple/fastfile.test.js.map +1 -1
- package/dist/test/apple/templates.test.js +32 -27
- package/dist/test/apple/templates.test.js.map +1 -1
- package/dist/test/apple/xcode-manager.test.js +182 -183
- package/dist/test/apple/xcode-manager.test.js.map +1 -1
- package/dist/test/flutter/code-tools.test.js +29 -28
- package/dist/test/flutter/code-tools.test.js.map +1 -1
- package/dist/test/flutter/templates.test.js +15 -14
- package/dist/test/flutter/templates.test.js.map +1 -1
- package/dist/test/nextjs/templates.test.js +43 -36
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/nuxt/templates.test.js +25 -24
- package/dist/test/nuxt/templates.test.js.map +1 -1
- package/dist/test/react-native/expo-metro.test.js +11 -10
- package/dist/test/react-native/expo-metro.test.js.map +1 -1
- package/dist/test/react-native/expo.test.js +11 -10
- package/dist/test/react-native/expo.test.js.map +1 -1
- package/dist/test/react-native/gradle.test.js +27 -26
- package/dist/test/react-native/gradle.test.js.map +1 -1
- package/dist/test/react-native/javascript.test.js +108 -58
- package/dist/test/react-native/javascript.test.js.map +1 -1
- package/dist/test/react-native/metro.test.js +65 -64
- package/dist/test/react-native/metro.test.js.map +1 -1
- package/dist/test/react-native/xcode.test.js +138 -37
- package/dist/test/react-native/xcode.test.js.map +1 -1
- package/dist/test/remix/client-entry.test.js +8 -7
- package/dist/test/remix/client-entry.test.js.map +1 -1
- package/dist/test/remix/server-instrumentation.test.js +6 -5
- package/dist/test/remix/server-instrumentation.test.js.map +1 -1
- package/dist/test/sourcemaps/tools/sentry-cli.test.js +20 -20
- package/dist/test/sourcemaps/tools/sentry-cli.test.js.map +1 -1
- package/dist/test/sourcemaps/tools/tsc.test.js +13 -14
- package/dist/test/sourcemaps/tools/tsc.test.js.map +1 -1
- package/dist/test/sourcemaps/tools/vite.test.js +13 -14
- package/dist/test/sourcemaps/tools/vite.test.js.map +1 -1
- package/dist/test/sourcemaps/tools/webpack.test.js +19 -20
- package/dist/test/sourcemaps/tools/webpack.test.js.map +1 -1
- package/dist/test/sveltekit/templates.test.js +13 -12
- package/dist/test/sveltekit/templates.test.js.map +1 -1
- package/dist/test/utils/ast-utils.test.js +45 -44
- package/dist/test/utils/ast-utils.test.js.map +1 -1
- package/dist/test/utils/clack/index.test.js +140 -144
- package/dist/test/utils/clack/index.test.js.map +1 -1
- package/dist/test/utils/package-manager.test.js +8 -7
- package/dist/test/utils/package-manager.test.js.map +1 -1
- package/package.json +10 -38
- package/dist/e2e-tests/jest.config.d.ts +0 -17
- package/dist/e2e-tests/jest.config.js +0 -23
- package/dist/e2e-tests/jest.config.js.map +0 -1
|
@@ -30,6 +30,7 @@ const path = __importStar(require("path"));
|
|
|
30
30
|
const code_tools_1 = require("../../src/apple/code-tools");
|
|
31
31
|
// @ts-expect-error - clack is ESM and TS complains about that. It works though
|
|
32
32
|
const clack = __importStar(require("@clack/prompts"));
|
|
33
|
+
const vitest_1 = require("vitest");
|
|
33
34
|
// Test Constants
|
|
34
35
|
const invalidAppDelegateSwift = `func application() {}`;
|
|
35
36
|
const validAppDelegateSwift = `
|
|
@@ -59,9 +60,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
|
59
60
|
// We recommend adjusting this value in production.
|
|
60
61
|
options.tracesSampleRate = 1.0
|
|
61
62
|
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
// Configure profiling. Visit https://docs.sentry.io/platforms/apple/profiling/ to learn more.
|
|
64
|
+
options.configureProfiling = {
|
|
65
|
+
$0.sessionSampleRate = 1.0 // We recommend adjusting this value in production.
|
|
66
|
+
$0.lifecycle = .trace
|
|
67
|
+
}
|
|
65
68
|
|
|
66
69
|
// Uncomment the following lines to add more data to your events
|
|
67
70
|
// options.attachScreenshot = true // This adds a screenshot to the error events
|
|
@@ -111,9 +114,11 @@ const validAppDelegateObjCWithSentry = `@import Sentry;
|
|
|
111
114
|
// We recommend adjusting this value in production.
|
|
112
115
|
options.tracesSampleRate = @1.0;
|
|
113
116
|
|
|
114
|
-
//
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
// Configure profiling. Visit https://docs.sentry.io/platforms/apple/profiling/ to learn more.
|
|
118
|
+
options.configureProfiling = ^(SentryProfileOptions *profiling) {
|
|
119
|
+
profiling.sessionSampleRate = 1.0; // We recommend adjusting this value in production.
|
|
120
|
+
profiling.lifecycle = SentryProfilingLifecycleTrace;
|
|
121
|
+
};
|
|
117
122
|
|
|
118
123
|
//Uncomment the following lines to add more data to your events
|
|
119
124
|
//options.attachScreenshot = YES; //This will add a screenshot to the error events
|
|
@@ -159,9 +164,11 @@ struct TestApp: App {
|
|
|
159
164
|
// We recommend adjusting this value in production.
|
|
160
165
|
options.tracesSampleRate = 1.0
|
|
161
166
|
|
|
162
|
-
//
|
|
163
|
-
|
|
164
|
-
|
|
167
|
+
// Configure profiling. Visit https://docs.sentry.io/platforms/apple/profiling/ to learn more.
|
|
168
|
+
options.configureProfiling = {
|
|
169
|
+
$0.sessionSampleRate = 1.0 // We recommend adjusting this value in production.
|
|
170
|
+
$0.lifecycle = .trace
|
|
171
|
+
}
|
|
165
172
|
|
|
166
173
|
// Uncomment the following lines to add more data to your events
|
|
167
174
|
// options.attachScreenshot = true // This adds a screenshot to the error events
|
|
@@ -187,25 +194,25 @@ const prepareAppDelegateFile = (dir, content, ext) => {
|
|
|
187
194
|
};
|
|
188
195
|
const dsn = 'https://example.com/sentry-dsn';
|
|
189
196
|
// Mock Setup
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
197
|
+
vitest_1.vi.mock('../../src/utils/bash');
|
|
198
|
+
vitest_1.vi.spyOn(Sentry, 'setTag').mockImplementation(() => undefined);
|
|
199
|
+
vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
|
|
193
200
|
// Test Suite
|
|
194
|
-
describe('code-tools', () => {
|
|
195
|
-
beforeEach(() => {
|
|
196
|
-
|
|
201
|
+
(0, vitest_1.describe)('code-tools', () => {
|
|
202
|
+
(0, vitest_1.beforeEach)(() => {
|
|
203
|
+
vitest_1.vi.spyOn(clack.log, 'info').mockImplementation(() => undefined);
|
|
197
204
|
});
|
|
198
|
-
afterEach(() => {
|
|
199
|
-
|
|
205
|
+
(0, vitest_1.afterEach)(() => {
|
|
206
|
+
vitest_1.vi.clearAllMocks();
|
|
200
207
|
});
|
|
201
|
-
describe('#isAppDelegateFile', () => {
|
|
208
|
+
(0, vitest_1.describe)('#isAppDelegateFile', () => {
|
|
202
209
|
const prepareTestFile = (content, ext) => {
|
|
203
210
|
const tempDir = prepareTempDir();
|
|
204
211
|
return prepareAppDelegateFile(tempDir, content, ext);
|
|
205
212
|
};
|
|
206
|
-
describe('swift files', () => {
|
|
207
|
-
describe('swift app launch regex', () => {
|
|
208
|
-
describe('valid cases', () => {
|
|
213
|
+
(0, vitest_1.describe)('swift files', () => {
|
|
214
|
+
(0, vitest_1.describe)('swift app launch regex', () => {
|
|
215
|
+
(0, vitest_1.describe)('valid cases', () => {
|
|
209
216
|
const variations = [
|
|
210
217
|
{
|
|
211
218
|
name: 'with underscores',
|
|
@@ -229,18 +236,18 @@ describe('code-tools', () => {
|
|
|
229
236
|
},
|
|
230
237
|
];
|
|
231
238
|
for (const variation of variations) {
|
|
232
|
-
describe(`${variation.name}`, () => {
|
|
233
|
-
it(`should return true`, () => {
|
|
239
|
+
(0, vitest_1.describe)(`${variation.name}`, () => {
|
|
240
|
+
(0, vitest_1.it)(`should return true`, () => {
|
|
234
241
|
// -- Arrange --
|
|
235
242
|
const filePath = prepareTestFile(variation.code, 'swift');
|
|
236
243
|
// -- Act --
|
|
237
244
|
const result = code_tools_1.exportForTesting.isAppDelegateFile(filePath);
|
|
238
245
|
// -- Assert --
|
|
239
|
-
expect(result).toBeTruthy();
|
|
246
|
+
(0, vitest_1.expect)(result).toBeTruthy();
|
|
240
247
|
});
|
|
241
248
|
});
|
|
242
249
|
}
|
|
243
|
-
describe('invalid cases', () => {
|
|
250
|
+
(0, vitest_1.describe)('invalid cases', () => {
|
|
244
251
|
const variations = [
|
|
245
252
|
{
|
|
246
253
|
name: 'missing application method',
|
|
@@ -256,14 +263,14 @@ describe('code-tools', () => {
|
|
|
256
263
|
},
|
|
257
264
|
];
|
|
258
265
|
for (const variation of variations) {
|
|
259
|
-
describe(`${variation.name}`, () => {
|
|
260
|
-
it('should return false', () => {
|
|
266
|
+
(0, vitest_1.describe)(`${variation.name}`, () => {
|
|
267
|
+
(0, vitest_1.it)('should return false', () => {
|
|
261
268
|
// -- Arrange --
|
|
262
269
|
const filePath = prepareTestFile(variation.code, 'swift');
|
|
263
270
|
// -- Act --
|
|
264
271
|
const result = code_tools_1.exportForTesting.isAppDelegateFile(filePath);
|
|
265
272
|
// -- Assert --
|
|
266
|
-
expect(result).toBeFalsy();
|
|
273
|
+
(0, vitest_1.expect)(result).toBeFalsy();
|
|
267
274
|
});
|
|
268
275
|
});
|
|
269
276
|
}
|
|
@@ -271,8 +278,8 @@ describe('code-tools', () => {
|
|
|
271
278
|
});
|
|
272
279
|
});
|
|
273
280
|
});
|
|
274
|
-
describe('objc files', () => {
|
|
275
|
-
describe('valid cases', () => {
|
|
281
|
+
(0, vitest_1.describe)('objc files', () => {
|
|
282
|
+
(0, vitest_1.describe)('valid cases', () => {
|
|
276
283
|
const variations = [
|
|
277
284
|
{
|
|
278
285
|
name: 'basic',
|
|
@@ -284,19 +291,19 @@ describe('code-tools', () => {
|
|
|
284
291
|
},
|
|
285
292
|
];
|
|
286
293
|
for (const variation of variations) {
|
|
287
|
-
describe(`${variation.name}`, () => {
|
|
288
|
-
it('should return true', () => {
|
|
294
|
+
(0, vitest_1.describe)(`${variation.name}`, () => {
|
|
295
|
+
(0, vitest_1.it)('should return true', () => {
|
|
289
296
|
// -- Arrange --
|
|
290
297
|
const filePath = prepareTestFile(variation.code, 'm');
|
|
291
298
|
// -- Act --
|
|
292
299
|
const result = code_tools_1.exportForTesting.isAppDelegateFile(filePath);
|
|
293
300
|
// -- Assert --
|
|
294
|
-
expect(result).toBeTruthy();
|
|
301
|
+
(0, vitest_1.expect)(result).toBeTruthy();
|
|
295
302
|
});
|
|
296
303
|
});
|
|
297
304
|
}
|
|
298
305
|
});
|
|
299
|
-
describe('invalid cases', () => {
|
|
306
|
+
(0, vitest_1.describe)('invalid cases', () => {
|
|
300
307
|
const variations = [
|
|
301
308
|
{
|
|
302
309
|
name: 'missing application method',
|
|
@@ -304,21 +311,21 @@ describe('code-tools', () => {
|
|
|
304
311
|
},
|
|
305
312
|
];
|
|
306
313
|
for (const variation of variations) {
|
|
307
|
-
describe(`${variation.name}`, () => {
|
|
308
|
-
it('should return false', () => {
|
|
314
|
+
(0, vitest_1.describe)(`${variation.name}`, () => {
|
|
315
|
+
(0, vitest_1.it)('should return false', () => {
|
|
309
316
|
// -- Arrange --
|
|
310
317
|
const filePath = prepareTestFile(variation.code, 'm');
|
|
311
318
|
// -- Act --
|
|
312
319
|
const result = code_tools_1.exportForTesting.isAppDelegateFile(filePath);
|
|
313
320
|
// -- Assert --
|
|
314
|
-
expect(result).toBeFalsy();
|
|
321
|
+
(0, vitest_1.expect)(result).toBeFalsy();
|
|
315
322
|
});
|
|
316
323
|
});
|
|
317
324
|
}
|
|
318
325
|
});
|
|
319
326
|
});
|
|
320
|
-
describe('swiftui files', () => {
|
|
321
|
-
describe('valid cases', () => {
|
|
327
|
+
(0, vitest_1.describe)('swiftui files', () => {
|
|
328
|
+
(0, vitest_1.describe)('valid cases', () => {
|
|
322
329
|
const variations = [
|
|
323
330
|
{
|
|
324
331
|
name: 'basic',
|
|
@@ -334,19 +341,19 @@ describe('code-tools', () => {
|
|
|
334
341
|
},
|
|
335
342
|
];
|
|
336
343
|
for (const variation of variations) {
|
|
337
|
-
describe(`${variation.name}`, () => {
|
|
338
|
-
it('should return true', () => {
|
|
344
|
+
(0, vitest_1.describe)(`${variation.name}`, () => {
|
|
345
|
+
(0, vitest_1.it)('should return true', () => {
|
|
339
346
|
// -- Arrange --
|
|
340
347
|
const filePath = prepareTestFile(variation.code, 'swift');
|
|
341
348
|
// -- Act --
|
|
342
349
|
const result = code_tools_1.exportForTesting.isAppDelegateFile(filePath);
|
|
343
350
|
// -- Assert --
|
|
344
|
-
expect(result).toBeTruthy();
|
|
351
|
+
(0, vitest_1.expect)(result).toBeTruthy();
|
|
345
352
|
});
|
|
346
353
|
});
|
|
347
354
|
}
|
|
348
355
|
});
|
|
349
|
-
describe('invalid cases', () => {
|
|
356
|
+
(0, vitest_1.describe)('invalid cases', () => {
|
|
350
357
|
const variations = [
|
|
351
358
|
{
|
|
352
359
|
name: 'missing @main',
|
|
@@ -366,161 +373,161 @@ describe('code-tools', () => {
|
|
|
366
373
|
},
|
|
367
374
|
];
|
|
368
375
|
for (const variation of variations) {
|
|
369
|
-
describe(`${variation.name}`, () => {
|
|
370
|
-
it('should return false', () => {
|
|
376
|
+
(0, vitest_1.describe)(`${variation.name}`, () => {
|
|
377
|
+
(0, vitest_1.it)('should return false', () => {
|
|
371
378
|
// -- Arrange --
|
|
372
379
|
const filePath = prepareTestFile(variation.code, 'swift');
|
|
373
380
|
// -- Act --
|
|
374
381
|
const result = code_tools_1.exportForTesting.isAppDelegateFile(filePath);
|
|
375
382
|
// -- Assert --
|
|
376
|
-
expect(result).toBeFalsy();
|
|
383
|
+
(0, vitest_1.expect)(result).toBeFalsy();
|
|
377
384
|
});
|
|
378
385
|
});
|
|
379
386
|
}
|
|
380
387
|
});
|
|
381
388
|
});
|
|
382
|
-
describe('file not found', () => {
|
|
383
|
-
it('should throw an error', () => {
|
|
389
|
+
(0, vitest_1.describe)('file not found', () => {
|
|
390
|
+
(0, vitest_1.it)('should throw an error', () => {
|
|
384
391
|
// -- Arrange --
|
|
385
392
|
const invalidPath = path.join(os.tmpdir(), 'invalid-path');
|
|
386
393
|
// -- Act & Assert --
|
|
387
|
-
expect(() => code_tools_1.exportForTesting.isAppDelegateFile(invalidPath)).toThrow();
|
|
394
|
+
(0, vitest_1.expect)(() => code_tools_1.exportForTesting.isAppDelegateFile(invalidPath)).toThrow();
|
|
388
395
|
});
|
|
389
396
|
});
|
|
390
397
|
});
|
|
391
|
-
describe('#findAppDidFinishLaunchingWithOptions', () => {
|
|
392
|
-
describe('no files given', () => {
|
|
393
|
-
it('should check files in directory', () => {
|
|
398
|
+
(0, vitest_1.describe)('#findAppDidFinishLaunchingWithOptions', () => {
|
|
399
|
+
(0, vitest_1.describe)('no files given', () => {
|
|
400
|
+
(0, vitest_1.it)('should check files in directory', () => {
|
|
394
401
|
// -- Arrange --
|
|
395
402
|
const tempDir = prepareTempDir();
|
|
396
403
|
const filePath = prepareAppDelegateFile(tempDir, validAppDelegateSwift, 'swift');
|
|
397
404
|
// -- Act --
|
|
398
405
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
|
|
399
406
|
// -- Assert --
|
|
400
|
-
expect(result).toBe(filePath);
|
|
407
|
+
(0, vitest_1.expect)(result).toBe(filePath);
|
|
401
408
|
});
|
|
402
409
|
});
|
|
403
|
-
describe('SwiftUI file found', () => {
|
|
404
|
-
describe('is app delegate', () => {
|
|
405
|
-
it('should return the file path', () => {
|
|
410
|
+
(0, vitest_1.describe)('SwiftUI file found', () => {
|
|
411
|
+
(0, vitest_1.describe)('is app delegate', () => {
|
|
412
|
+
(0, vitest_1.it)('should return the file path', () => {
|
|
406
413
|
// -- Arrange --
|
|
407
414
|
const tempDir = prepareTempDir();
|
|
408
415
|
const filePath = prepareAppDelegateFile(tempDir, validAppDelegateSwiftUI, 'swift');
|
|
409
416
|
// -- Act --
|
|
410
417
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
|
|
411
418
|
// -- Assert --
|
|
412
|
-
expect(result).toBe(filePath);
|
|
419
|
+
(0, vitest_1.expect)(result).toBe(filePath);
|
|
413
420
|
});
|
|
414
421
|
});
|
|
415
|
-
describe('is not app delegate', () => {
|
|
416
|
-
it('should be ignored', () => {
|
|
422
|
+
(0, vitest_1.describe)('is not app delegate', () => {
|
|
423
|
+
(0, vitest_1.it)('should be ignored', () => {
|
|
417
424
|
// -- Arrange --
|
|
418
425
|
const tempDir = prepareTempDir();
|
|
419
426
|
prepareAppDelegateFile(tempDir, invalidAppDelegateSwiftUI, 'swift');
|
|
420
427
|
// -- Act --
|
|
421
428
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
|
|
422
429
|
// -- Assert --
|
|
423
|
-
expect(result).toBeNull();
|
|
430
|
+
(0, vitest_1.expect)(result).toBeNull();
|
|
424
431
|
});
|
|
425
432
|
});
|
|
426
433
|
});
|
|
427
|
-
describe('Swift file found', () => {
|
|
428
|
-
describe('is app delegate', () => {
|
|
429
|
-
it('should return the file path', () => {
|
|
434
|
+
(0, vitest_1.describe)('Swift file found', () => {
|
|
435
|
+
(0, vitest_1.describe)('is app delegate', () => {
|
|
436
|
+
(0, vitest_1.it)('should return the file path', () => {
|
|
430
437
|
// -- Arrange --
|
|
431
438
|
const tempDir = prepareTempDir();
|
|
432
439
|
const filePath = prepareAppDelegateFile(tempDir, validAppDelegateSwift, 'swift');
|
|
433
440
|
// -- Act --
|
|
434
441
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
|
|
435
442
|
// -- Assert --
|
|
436
|
-
expect(result).toBe(filePath);
|
|
443
|
+
(0, vitest_1.expect)(result).toBe(filePath);
|
|
437
444
|
});
|
|
438
445
|
});
|
|
439
|
-
describe('is not app delegate', () => {
|
|
440
|
-
it('should be ignored', () => {
|
|
446
|
+
(0, vitest_1.describe)('is not app delegate', () => {
|
|
447
|
+
(0, vitest_1.it)('should be ignored', () => {
|
|
441
448
|
// -- Arrange --
|
|
442
449
|
const tempDir = prepareTempDir();
|
|
443
450
|
prepareAppDelegateFile(tempDir, invalidAppDelegateSwift, 'swift');
|
|
444
451
|
// -- Act --
|
|
445
452
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
|
|
446
453
|
// -- Assert --
|
|
447
|
-
expect(result).toBeNull();
|
|
454
|
+
(0, vitest_1.expect)(result).toBeNull();
|
|
448
455
|
});
|
|
449
456
|
});
|
|
450
457
|
});
|
|
451
|
-
describe('Objective-C file found', () => {
|
|
452
|
-
describe('is app delegate', () => {
|
|
453
|
-
it('should return the file path', () => {
|
|
458
|
+
(0, vitest_1.describe)('Objective-C file found', () => {
|
|
459
|
+
(0, vitest_1.describe)('is app delegate', () => {
|
|
460
|
+
(0, vitest_1.it)('should return the file path', () => {
|
|
454
461
|
// -- Arrange --
|
|
455
462
|
const tempDir = prepareTempDir();
|
|
456
463
|
const filePath = prepareAppDelegateFile(tempDir, validAppDelegateObjC, 'm');
|
|
457
464
|
// -- Act --
|
|
458
465
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
|
|
459
466
|
// -- Assert --
|
|
460
|
-
expect(result).toBe(filePath);
|
|
467
|
+
(0, vitest_1.expect)(result).toBe(filePath);
|
|
461
468
|
});
|
|
462
469
|
});
|
|
463
|
-
describe('is not app delegate', () => {
|
|
464
|
-
it('should be ignored', () => {
|
|
470
|
+
(0, vitest_1.describe)('is not app delegate', () => {
|
|
471
|
+
(0, vitest_1.it)('should be ignored', () => {
|
|
465
472
|
// -- Arrange --
|
|
466
473
|
const tempDir = prepareTempDir();
|
|
467
474
|
prepareAppDelegateFile(tempDir, invalidAppDelegateObjC, 'm');
|
|
468
475
|
// -- Act --
|
|
469
476
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
|
|
470
477
|
// -- Assert --
|
|
471
|
-
expect(result).toBeNull();
|
|
478
|
+
(0, vitest_1.expect)(result).toBeNull();
|
|
472
479
|
});
|
|
473
480
|
});
|
|
474
481
|
});
|
|
475
|
-
describe('Objective-C++ file found', () => {
|
|
476
|
-
describe('is app delegate', () => {
|
|
477
|
-
it('should return the file path', () => {
|
|
482
|
+
(0, vitest_1.describe)('Objective-C++ file found', () => {
|
|
483
|
+
(0, vitest_1.describe)('is app delegate', () => {
|
|
484
|
+
(0, vitest_1.it)('should return the file path', () => {
|
|
478
485
|
// -- Arrange --
|
|
479
486
|
const tempDir = prepareTempDir();
|
|
480
487
|
const filePath = prepareAppDelegateFile(tempDir, validAppDelegateObjC, 'mm');
|
|
481
488
|
// -- Act --
|
|
482
489
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir, [filePath]);
|
|
483
490
|
// -- Assert --
|
|
484
|
-
expect(result).toBe(filePath);
|
|
491
|
+
(0, vitest_1.expect)(result).toBe(filePath);
|
|
485
492
|
});
|
|
486
493
|
});
|
|
487
|
-
describe('is not app delegate', () => {
|
|
488
|
-
it('should be ignored', () => {
|
|
494
|
+
(0, vitest_1.describe)('is not app delegate', () => {
|
|
495
|
+
(0, vitest_1.it)('should be ignored', () => {
|
|
489
496
|
// -- Arrange --
|
|
490
497
|
const tempDir = prepareTempDir();
|
|
491
498
|
prepareAppDelegateFile(tempDir, invalidAppDelegateObjC, 'mm');
|
|
492
499
|
// -- Act --
|
|
493
500
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
|
|
494
501
|
// -- Assert --
|
|
495
|
-
expect(result).toBeNull();
|
|
502
|
+
(0, vitest_1.expect)(result).toBeNull();
|
|
496
503
|
});
|
|
497
504
|
});
|
|
498
505
|
});
|
|
499
|
-
describe('file in list not found', () => {
|
|
500
|
-
it('should return null', () => {
|
|
506
|
+
(0, vitest_1.describe)('file in list not found', () => {
|
|
507
|
+
(0, vitest_1.it)('should return null', () => {
|
|
501
508
|
// -- Arrange --
|
|
502
509
|
const tempDir = prepareTempDir();
|
|
503
510
|
const filePath = prepareAppDelegateFile(tempDir, invalidAppDelegateSwift, 'swift');
|
|
504
511
|
// -- Act --
|
|
505
512
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir, [filePath]);
|
|
506
513
|
// -- Assert --
|
|
507
|
-
expect(result).toBeNull();
|
|
514
|
+
(0, vitest_1.expect)(result).toBeNull();
|
|
508
515
|
});
|
|
509
516
|
});
|
|
510
|
-
describe('unrelated file found', () => {
|
|
511
|
-
it('should be ignored', () => {
|
|
517
|
+
(0, vitest_1.describe)('unrelated file found', () => {
|
|
518
|
+
(0, vitest_1.it)('should be ignored', () => {
|
|
512
519
|
// -- Arrange --
|
|
513
520
|
const tempDir = prepareTempDir();
|
|
514
521
|
const filePath = prepareAppDelegateFile(tempDir, invalidAppDelegateSwift, 'swift');
|
|
515
522
|
// -- Act --
|
|
516
523
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir, [filePath]);
|
|
517
524
|
// -- Assert --
|
|
518
|
-
expect(result).toBeNull();
|
|
525
|
+
(0, vitest_1.expect)(result).toBeNull();
|
|
519
526
|
});
|
|
520
527
|
});
|
|
521
|
-
describe('directory in list', () => {
|
|
522
|
-
describe('name starts with dot', () => {
|
|
523
|
-
it('should be ignored', () => {
|
|
528
|
+
(0, vitest_1.describe)('directory in list', () => {
|
|
529
|
+
(0, vitest_1.describe)('name starts with dot', () => {
|
|
530
|
+
(0, vitest_1.it)('should be ignored', () => {
|
|
524
531
|
// -- Arrange --
|
|
525
532
|
const tempDir = prepareTempDir();
|
|
526
533
|
const hiddenDir = path.join(tempDir, '.hidden');
|
|
@@ -529,11 +536,11 @@ describe('code-tools', () => {
|
|
|
529
536
|
// -- Act --
|
|
530
537
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
|
|
531
538
|
// -- Assert --
|
|
532
|
-
expect(result).toBeNull();
|
|
539
|
+
(0, vitest_1.expect)(result).toBeNull();
|
|
533
540
|
});
|
|
534
541
|
});
|
|
535
|
-
describe('name ends with .xcodeproj', () => {
|
|
536
|
-
it('should be ignored', () => {
|
|
542
|
+
(0, vitest_1.describe)('name ends with .xcodeproj', () => {
|
|
543
|
+
(0, vitest_1.it)('should be ignored', () => {
|
|
537
544
|
// -- Arrange --
|
|
538
545
|
const tempDir = prepareTempDir();
|
|
539
546
|
const xcodeDir = path.join(tempDir, 'MyProject.xcodeproj');
|
|
@@ -542,11 +549,11 @@ describe('code-tools', () => {
|
|
|
542
549
|
// -- Act --
|
|
543
550
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
|
|
544
551
|
// -- Assert --
|
|
545
|
-
expect(result).toBeNull();
|
|
552
|
+
(0, vitest_1.expect)(result).toBeNull();
|
|
546
553
|
});
|
|
547
554
|
});
|
|
548
|
-
describe('name ends with .xcassets', () => {
|
|
549
|
-
it('should be ignored', () => {
|
|
555
|
+
(0, vitest_1.describe)('name ends with .xcassets', () => {
|
|
556
|
+
(0, vitest_1.it)('should be ignored', () => {
|
|
550
557
|
// -- Arrange --
|
|
551
558
|
const tempDir = prepareTempDir();
|
|
552
559
|
const xcassetsDir = path.join(tempDir, 'MyProject.xcassets');
|
|
@@ -555,11 +562,11 @@ describe('code-tools', () => {
|
|
|
555
562
|
// -- Act --
|
|
556
563
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
|
|
557
564
|
// -- Assert --
|
|
558
|
-
expect(result).toBeNull();
|
|
565
|
+
(0, vitest_1.expect)(result).toBeNull();
|
|
559
566
|
});
|
|
560
567
|
});
|
|
561
|
-
describe('is not a directory', () => {
|
|
562
|
-
it('should be ignored', () => {
|
|
568
|
+
(0, vitest_1.describe)('is not a directory', () => {
|
|
569
|
+
(0, vitest_1.it)('should be ignored', () => {
|
|
563
570
|
// -- Arrange --
|
|
564
571
|
const tempDir = prepareTempDir();
|
|
565
572
|
const filePath = path.join(tempDir, 'some-file');
|
|
@@ -567,12 +574,12 @@ describe('code-tools', () => {
|
|
|
567
574
|
// -- Act --
|
|
568
575
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
|
|
569
576
|
// -- Assert --
|
|
570
|
-
expect(result).toBeNull();
|
|
577
|
+
(0, vitest_1.expect)(result).toBeNull();
|
|
571
578
|
});
|
|
572
579
|
});
|
|
573
580
|
});
|
|
574
|
-
describe('multiple files could be app delegate', () => {
|
|
575
|
-
it('should return the first one', () => {
|
|
581
|
+
(0, vitest_1.describe)('multiple files could be app delegate', () => {
|
|
582
|
+
(0, vitest_1.it)('should return the first one', () => {
|
|
576
583
|
// -- Arrange --
|
|
577
584
|
const tempDir = prepareTempDir();
|
|
578
585
|
const filePath = prepareAppDelegateFile(tempDir, validAppDelegateSwift, 'swift');
|
|
@@ -580,11 +587,11 @@ describe('code-tools', () => {
|
|
|
580
587
|
// -- Act --
|
|
581
588
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
|
|
582
589
|
// -- Assert --
|
|
583
|
-
expect(result).toBe(filePath);
|
|
590
|
+
(0, vitest_1.expect)(result).toBe(filePath);
|
|
584
591
|
});
|
|
585
592
|
});
|
|
586
|
-
describe('multiple nested directories with app delegate', () => {
|
|
587
|
-
it('should return the first one', () => {
|
|
593
|
+
(0, vitest_1.describe)('multiple nested directories with app delegate', () => {
|
|
594
|
+
(0, vitest_1.it)('should return the first one', () => {
|
|
588
595
|
// -- Arrange --
|
|
589
596
|
const tempDir = prepareTempDir();
|
|
590
597
|
const nestedDir = path.join(tempDir, 'nested');
|
|
@@ -596,187 +603,187 @@ describe('code-tools', () => {
|
|
|
596
603
|
// -- Act --
|
|
597
604
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
|
|
598
605
|
// -- Assert --
|
|
599
|
-
expect(result).toBe(nestedFilePath);
|
|
606
|
+
(0, vitest_1.expect)(result).toBe(nestedFilePath);
|
|
600
607
|
});
|
|
601
608
|
});
|
|
602
|
-
describe('no app delegate found', () => {
|
|
603
|
-
it('should return null', () => {
|
|
609
|
+
(0, vitest_1.describe)('no app delegate found', () => {
|
|
610
|
+
(0, vitest_1.it)('should return null', () => {
|
|
604
611
|
// -- Arrange --
|
|
605
612
|
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'code-tools-test'));
|
|
606
613
|
// -- Act --
|
|
607
614
|
const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir, []);
|
|
608
615
|
// -- Assert --
|
|
609
|
-
expect(result).toBeNull();
|
|
616
|
+
(0, vitest_1.expect)(result).toBeNull();
|
|
610
617
|
});
|
|
611
618
|
});
|
|
612
619
|
});
|
|
613
|
-
describe('#addCodeSnippetToProject', () => {
|
|
614
|
-
describe('app delegate file is not found', () => {
|
|
615
|
-
it('should return false', () => {
|
|
620
|
+
(0, vitest_1.describe)('#addCodeSnippetToProject', () => {
|
|
621
|
+
(0, vitest_1.describe)('app delegate file is not found', () => {
|
|
622
|
+
(0, vitest_1.it)('should return false', () => {
|
|
616
623
|
// -- Arrange --
|
|
617
624
|
const tempDir = prepareTempDir();
|
|
618
625
|
// -- Act --
|
|
619
626
|
const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, ['AppDelegate.swift'], 'https://example.com/sentry-dsn');
|
|
620
627
|
// -- Assert --
|
|
621
|
-
expect(result).toBeFalsy();
|
|
628
|
+
(0, vitest_1.expect)(result).toBeFalsy();
|
|
622
629
|
});
|
|
623
630
|
});
|
|
624
|
-
describe('app delegate file is found', () => {
|
|
631
|
+
(0, vitest_1.describe)('app delegate file is found', () => {
|
|
625
632
|
let tempDir;
|
|
626
633
|
let appDelegatePath;
|
|
627
|
-
beforeEach(() => {
|
|
634
|
+
(0, vitest_1.beforeEach)(() => {
|
|
628
635
|
// -- Arrange --
|
|
629
636
|
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'code-tools-test'));
|
|
630
637
|
appDelegatePath = path.join(tempDir, 'AppDelegate.swift');
|
|
631
638
|
fs.writeFileSync(appDelegatePath, validAppDelegateSwift, 'utf8');
|
|
632
639
|
});
|
|
633
|
-
describe('is Swift file', () => {
|
|
634
|
-
describe('Sentry is not initialized', () => {
|
|
640
|
+
(0, vitest_1.describe)('is Swift file', () => {
|
|
641
|
+
(0, vitest_1.describe)('Sentry is not initialized', () => {
|
|
635
642
|
let tempDir;
|
|
636
643
|
let filePath;
|
|
637
|
-
beforeEach(() => {
|
|
644
|
+
(0, vitest_1.beforeEach)(() => {
|
|
638
645
|
tempDir = prepareTempDir();
|
|
639
646
|
filePath = prepareAppDelegateFile(tempDir, validAppDelegateSwift, 'swift');
|
|
640
647
|
});
|
|
641
|
-
it('should add the code snippet', () => {
|
|
648
|
+
(0, vitest_1.it)('should add the code snippet', () => {
|
|
642
649
|
// -- Act --
|
|
643
650
|
const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
|
|
644
651
|
// -- Assert --
|
|
645
|
-
expect(result).toBeTruthy();
|
|
652
|
+
(0, vitest_1.expect)(result).toBeTruthy();
|
|
646
653
|
const modifiedFileContent = fs.readFileSync(filePath, 'utf8');
|
|
647
|
-
expect(modifiedFileContent).toBe(validAppDelegateSwiftWithSentry);
|
|
654
|
+
(0, vitest_1.expect)(modifiedFileContent).toBe(validAppDelegateSwiftWithSentry);
|
|
648
655
|
});
|
|
649
|
-
it("should set tag 'code-language'", () => {
|
|
656
|
+
(0, vitest_1.it)("should set tag 'code-language'", () => {
|
|
650
657
|
// -- Act --
|
|
651
658
|
const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
|
|
652
659
|
// -- Assert --
|
|
653
|
-
expect(result).toBeTruthy();
|
|
654
|
-
expect(Sentry.setTag).toHaveBeenCalledWith('code-language', 'swift');
|
|
660
|
+
(0, vitest_1.expect)(result).toBeTruthy();
|
|
661
|
+
(0, vitest_1.expect)(Sentry.setTag).toHaveBeenCalledWith('code-language', 'swift');
|
|
655
662
|
});
|
|
656
|
-
it("should set tag 'ui-engine'", () => {
|
|
663
|
+
(0, vitest_1.it)("should set tag 'ui-engine'", () => {
|
|
657
664
|
// -- Act --
|
|
658
665
|
const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
|
|
659
666
|
// -- Assert --
|
|
660
|
-
expect(result).toBeTruthy();
|
|
661
|
-
expect(Sentry.setTag).toHaveBeenCalledWith('ui-engine', 'uikit');
|
|
667
|
+
(0, vitest_1.expect)(result).toBeTruthy();
|
|
668
|
+
(0, vitest_1.expect)(Sentry.setTag).toHaveBeenCalledWith('ui-engine', 'uikit');
|
|
662
669
|
});
|
|
663
670
|
});
|
|
664
|
-
describe('Sentry is already initialized', () => {
|
|
665
|
-
it('should not add the code snippet', () => {
|
|
671
|
+
(0, vitest_1.describe)('Sentry is already initialized', () => {
|
|
672
|
+
(0, vitest_1.it)('should not add the code snippet', () => {
|
|
666
673
|
// -- Arrange --
|
|
667
674
|
const tempDir = prepareTempDir();
|
|
668
675
|
const filePath = prepareAppDelegateFile(tempDir, validAppDelegateSwiftWithSentry, 'swift');
|
|
669
676
|
// -- Act --
|
|
670
677
|
const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
|
|
671
678
|
// -- Assert --
|
|
672
|
-
expect(result).toBeTruthy();
|
|
679
|
+
(0, vitest_1.expect)(result).toBeTruthy();
|
|
673
680
|
const modifiedFileContent = fs.readFileSync(filePath, 'utf8');
|
|
674
|
-
expect(modifiedFileContent).toBe(validAppDelegateSwiftWithSentry);
|
|
681
|
+
(0, vitest_1.expect)(modifiedFileContent).toBe(validAppDelegateSwiftWithSentry);
|
|
675
682
|
});
|
|
676
683
|
});
|
|
677
|
-
describe('is SwiftUI file', () => {
|
|
678
|
-
describe('Sentry is not initialized', () => {
|
|
684
|
+
(0, vitest_1.describe)('is SwiftUI file', () => {
|
|
685
|
+
(0, vitest_1.describe)('Sentry is not initialized', () => {
|
|
679
686
|
let tempDir;
|
|
680
687
|
let filePath;
|
|
681
|
-
beforeEach(() => {
|
|
688
|
+
(0, vitest_1.beforeEach)(() => {
|
|
682
689
|
tempDir = prepareTempDir();
|
|
683
690
|
filePath = prepareAppDelegateFile(tempDir, validAppDelegateSwiftUI, 'swift');
|
|
684
691
|
});
|
|
685
|
-
it('should add the code snippet', () => {
|
|
692
|
+
(0, vitest_1.it)('should add the code snippet', () => {
|
|
686
693
|
// -- Act --
|
|
687
694
|
const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
|
|
688
695
|
// -- Assert --
|
|
689
|
-
expect(result).toBeTruthy();
|
|
696
|
+
(0, vitest_1.expect)(result).toBeTruthy();
|
|
690
697
|
const modifiedFileContent = fs.readFileSync(filePath, 'utf8');
|
|
691
|
-
expect(modifiedFileContent).toBe(validAppDelegateSwiftUIWithSentry);
|
|
698
|
+
(0, vitest_1.expect)(modifiedFileContent).toBe(validAppDelegateSwiftUIWithSentry);
|
|
692
699
|
});
|
|
693
|
-
it("should set tag 'code-language'", () => {
|
|
700
|
+
(0, vitest_1.it)("should set tag 'code-language'", () => {
|
|
694
701
|
// -- Act --
|
|
695
702
|
const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
|
|
696
703
|
// -- Assert --
|
|
697
|
-
expect(result).toBeTruthy();
|
|
698
|
-
expect(Sentry.setTag).toHaveBeenNthCalledWith(1, 'code-language', 'swift');
|
|
704
|
+
(0, vitest_1.expect)(result).toBeTruthy();
|
|
705
|
+
(0, vitest_1.expect)(Sentry.setTag).toHaveBeenNthCalledWith(1, 'code-language', 'swift');
|
|
699
706
|
});
|
|
700
|
-
it("should set tag 'ui-engine'", () => {
|
|
707
|
+
(0, vitest_1.it)("should set tag 'ui-engine'", () => {
|
|
701
708
|
// -- Act --
|
|
702
709
|
const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
|
|
703
710
|
// -- Assert --
|
|
704
|
-
expect(result).toBeTruthy();
|
|
705
|
-
expect(Sentry.setTag).toHaveBeenNthCalledWith(2, 'ui-engine', 'swiftui');
|
|
711
|
+
(0, vitest_1.expect)(result).toBeTruthy();
|
|
712
|
+
(0, vitest_1.expect)(Sentry.setTag).toHaveBeenNthCalledWith(2, 'ui-engine', 'swiftui');
|
|
706
713
|
});
|
|
707
714
|
});
|
|
708
|
-
describe('Sentry is already initialized', () => {
|
|
709
|
-
it('should not add the code snippet', () => {
|
|
715
|
+
(0, vitest_1.describe)('Sentry is already initialized', () => {
|
|
716
|
+
(0, vitest_1.it)('should not add the code snippet', () => {
|
|
710
717
|
// -- Arrange --
|
|
711
718
|
const tempDir = prepareTempDir();
|
|
712
719
|
const filePath = prepareAppDelegateFile(tempDir, validAppDelegateSwiftUIWithSentry, 'swift');
|
|
713
720
|
// -- Act --
|
|
714
721
|
const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
|
|
715
722
|
// -- Assert --
|
|
716
|
-
expect(result).toBeTruthy();
|
|
723
|
+
(0, vitest_1.expect)(result).toBeTruthy();
|
|
717
724
|
const modifiedFileContent = fs.readFileSync(filePath, 'utf8');
|
|
718
|
-
expect(modifiedFileContent).toBe(validAppDelegateSwiftUIWithSentry);
|
|
725
|
+
(0, vitest_1.expect)(modifiedFileContent).toBe(validAppDelegateSwiftUIWithSentry);
|
|
719
726
|
});
|
|
720
727
|
});
|
|
721
728
|
});
|
|
722
|
-
describe('is not matching SwiftUI regex', () => {
|
|
723
|
-
it('should not add the code snippet', () => {
|
|
729
|
+
(0, vitest_1.describe)('is not matching SwiftUI regex', () => {
|
|
730
|
+
(0, vitest_1.it)('should not add the code snippet', () => {
|
|
724
731
|
// -- Arrange --
|
|
725
732
|
const tempDir = prepareTempDir();
|
|
726
733
|
const filePath = prepareAppDelegateFile(tempDir, invalidAppDelegateSwiftUI, 'swift');
|
|
727
734
|
// -- Act --
|
|
728
735
|
const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
|
|
729
736
|
// -- Assert --
|
|
730
|
-
expect(result).toBeFalsy();
|
|
737
|
+
(0, vitest_1.expect)(result).toBeFalsy();
|
|
731
738
|
});
|
|
732
739
|
});
|
|
733
740
|
});
|
|
734
|
-
describe('is Objective-C file', () => {
|
|
735
|
-
describe('Sentry is not initialized', () => {
|
|
736
|
-
it('should add the code snippet', () => {
|
|
741
|
+
(0, vitest_1.describe)('is Objective-C file', () => {
|
|
742
|
+
(0, vitest_1.describe)('Sentry is not initialized', () => {
|
|
743
|
+
(0, vitest_1.it)('should add the code snippet', () => {
|
|
737
744
|
// -- Act --
|
|
738
745
|
const tempDir = prepareTempDir();
|
|
739
746
|
const filePath = prepareAppDelegateFile(tempDir, validAppDelegateObjC, 'm');
|
|
740
747
|
// -- Act --
|
|
741
748
|
const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
|
|
742
749
|
// -- Assert --
|
|
743
|
-
expect(result).toBeTruthy();
|
|
750
|
+
(0, vitest_1.expect)(result).toBeTruthy();
|
|
744
751
|
const modifiedFileContent = fs.readFileSync(filePath, 'utf8');
|
|
745
|
-
expect(modifiedFileContent).toBe(validAppDelegateObjCWithSentry);
|
|
752
|
+
(0, vitest_1.expect)(modifiedFileContent).toBe(validAppDelegateObjCWithSentry);
|
|
746
753
|
});
|
|
747
754
|
});
|
|
748
|
-
describe('Sentry is already initialized', () => {
|
|
755
|
+
(0, vitest_1.describe)('Sentry is already initialized', () => {
|
|
749
756
|
let tempDir;
|
|
750
757
|
let filePath;
|
|
751
|
-
beforeEach(() => {
|
|
758
|
+
(0, vitest_1.beforeEach)(() => {
|
|
752
759
|
tempDir = prepareTempDir();
|
|
753
760
|
filePath = prepareAppDelegateFile(tempDir, validAppDelegateObjCWithSentry, 'm');
|
|
754
761
|
});
|
|
755
|
-
it('should not add the code snippet', () => {
|
|
762
|
+
(0, vitest_1.it)('should not add the code snippet', () => {
|
|
756
763
|
// -- Act --
|
|
757
764
|
const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
|
|
758
765
|
// -- Assert --
|
|
759
|
-
expect(result).toBeTruthy();
|
|
766
|
+
(0, vitest_1.expect)(result).toBeTruthy();
|
|
760
767
|
const modifiedFileContent = fs.readFileSync(filePath, 'utf8');
|
|
761
|
-
expect(modifiedFileContent).toBe(validAppDelegateObjCWithSentry);
|
|
768
|
+
(0, vitest_1.expect)(modifiedFileContent).toBe(validAppDelegateObjCWithSentry);
|
|
762
769
|
});
|
|
763
|
-
it('should log info', () => {
|
|
770
|
+
(0, vitest_1.it)('should log info', () => {
|
|
764
771
|
// -- Act --
|
|
765
772
|
const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
|
|
766
773
|
// -- Assert --
|
|
767
|
-
expect(result).toBeTruthy();
|
|
768
|
-
expect(clack.log.info).toHaveBeenCalledWith('Sentry is already initialized in your AppDelegate. Skipping adding the code snippet.');
|
|
774
|
+
(0, vitest_1.expect)(result).toBeTruthy();
|
|
775
|
+
(0, vitest_1.expect)(clack.log.info).toHaveBeenCalledWith('Sentry is already initialized in your AppDelegate. Skipping adding the code snippet.');
|
|
769
776
|
});
|
|
770
777
|
});
|
|
771
|
-
it("should set tag 'code-language'", () => {
|
|
778
|
+
(0, vitest_1.it)("should set tag 'code-language'", () => {
|
|
772
779
|
// -- Arrange --
|
|
773
780
|
const tempDir = prepareTempDir();
|
|
774
781
|
const filePath = prepareAppDelegateFile(tempDir, validAppDelegateObjC, 'm');
|
|
775
782
|
// -- Act --
|
|
776
783
|
const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
|
|
777
784
|
// -- Assert --
|
|
778
|
-
expect(result).toBeTruthy();
|
|
779
|
-
expect(Sentry.setTag).toHaveBeenCalledWith('code-language', 'objc');
|
|
785
|
+
(0, vitest_1.expect)(result).toBeTruthy();
|
|
786
|
+
(0, vitest_1.expect)(Sentry.setTag).toHaveBeenCalledWith('code-language', 'objc');
|
|
780
787
|
});
|
|
781
788
|
});
|
|
782
789
|
});
|