@sentry/wizard 5.0.0 → 5.2.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 +13 -0
- package/dist/e2e-tests/tests/cloudflare-wrangler-sourcemaps.test.d.ts +1 -0
- package/dist/e2e-tests/tests/cloudflare-wrangler-sourcemaps.test.js +91 -0
- package/dist/e2e-tests/tests/cloudflare-wrangler-sourcemaps.test.js.map +1 -0
- package/dist/e2e-tests/tests/expo.test.js +19 -9
- package/dist/e2e-tests/tests/expo.test.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-14.test.js +27 -0
- package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
- package/dist/e2e-tests/tests/react-native.test.js +19 -13
- package/dist/e2e-tests/tests/react-native.test.js.map +1 -1
- package/dist/e2e-tests/utils/index.d.ts +17 -0
- package/dist/e2e-tests/utils/index.js +94 -1
- package/dist/e2e-tests/utils/index.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +38 -20
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.d.ts +9 -2
- package/dist/src/nextjs/templates.js +70 -15
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nextjs/utils.d.ts +2 -0
- package/dist/src/nextjs/utils.js +42 -1
- package/dist/src/nextjs/utils.js.map +1 -1
- package/dist/src/nuxt/templates.js +29 -12
- package/dist/src/nuxt/templates.js.map +1 -1
- package/dist/src/remix/sdk-example.js +20 -5
- package/dist/src/remix/sdk-example.js.map +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.js +14 -0
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/sourcemaps/tools/wrangler.d.ts +28 -0
- package/dist/src/sourcemaps/tools/wrangler.js +276 -0
- package/dist/src/sourcemaps/tools/wrangler.js.map +1 -0
- package/dist/src/sourcemaps/utils/detect-tool.d.ts +1 -1
- package/dist/src/sourcemaps/utils/detect-tool.js +1 -0
- package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -1
- package/dist/src/sveltekit/templates.js +13 -6
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/dist/src/utils/clack/index.d.ts +9 -1
- package/dist/src/utils/clack/index.js +8 -1
- package/dist/src/utils/clack/index.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/nextjs/templates.test.js +176 -0
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/nextjs/utils.test.d.ts +1 -0
- package/dist/test/nextjs/utils.test.js +104 -0
- package/dist/test/nextjs/utils.test.js.map +1 -0
- package/dist/test/sourcemaps/tools/wrangler.test.d.ts +1 -0
- package/dist/test/sourcemaps/tools/wrangler.test.js +132 -0
- package/dist/test/sourcemaps/tools/wrangler.test.js.map +1 -0
- package/package.json +2 -1
|
@@ -402,5 +402,181 @@ const templates_1 = require("../../src/nextjs/templates");
|
|
|
402
402
|
`);
|
|
403
403
|
});
|
|
404
404
|
});
|
|
405
|
+
(0, vitest_1.describe)('getGenerateMetadataSnippet', () => {
|
|
406
|
+
(0, vitest_1.it)('generates metadata snippet with TypeScript types', () => {
|
|
407
|
+
const template = (0, templates_1.getGenerateMetadataSnippet)(true);
|
|
408
|
+
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
409
|
+
"
|
|
410
|
+
import * as Sentry from '@sentry/nextjs';
|
|
411
|
+
import type { Metadata } from 'next';
|
|
412
|
+
|
|
413
|
+
// Add or edit your "generateMetadata" to include the Sentry trace data:
|
|
414
|
+
export function generateMetadata(): Metadata {
|
|
415
|
+
return {
|
|
416
|
+
// ... your existing metadata
|
|
417
|
+
other: {
|
|
418
|
+
...Sentry.getTraceData()
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
"
|
|
423
|
+
`);
|
|
424
|
+
});
|
|
425
|
+
(0, vitest_1.it)('generates metadata snippet without TypeScript types', () => {
|
|
426
|
+
const template = (0, templates_1.getGenerateMetadataSnippet)(false);
|
|
427
|
+
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
428
|
+
"
|
|
429
|
+
import * as Sentry from '@sentry/nextjs';
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
// Add or edit your "generateMetadata" to include the Sentry trace data:
|
|
433
|
+
export function generateMetadata() {
|
|
434
|
+
return {
|
|
435
|
+
// ... your existing metadata
|
|
436
|
+
other: {
|
|
437
|
+
...Sentry.getTraceData()
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
"
|
|
442
|
+
`);
|
|
443
|
+
});
|
|
444
|
+
});
|
|
445
|
+
(0, vitest_1.describe)('getRootLayoutWithGenerateMetadata', () => {
|
|
446
|
+
(0, vitest_1.it)('generates root layout with TypeScript types', () => {
|
|
447
|
+
const template = (0, templates_1.getRootLayoutWithGenerateMetadata)(true);
|
|
448
|
+
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
449
|
+
"// This file was generated by the Sentry wizard because we couldn't find a root layout file.
|
|
450
|
+
import * as Sentry from '@sentry/nextjs';
|
|
451
|
+
import type { Metadata } from 'next';
|
|
452
|
+
|
|
453
|
+
export function generateMetadata(): Metadata {
|
|
454
|
+
return {
|
|
455
|
+
other: {
|
|
456
|
+
...Sentry.getTraceData(),
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
export default function RootLayout({
|
|
462
|
+
children,
|
|
463
|
+
}: {
|
|
464
|
+
children: React.ReactNode
|
|
465
|
+
}) {
|
|
466
|
+
return (
|
|
467
|
+
<html lang="en">
|
|
468
|
+
<body>{children}</body>
|
|
469
|
+
</html>
|
|
470
|
+
)
|
|
471
|
+
}
|
|
472
|
+
"
|
|
473
|
+
`);
|
|
474
|
+
});
|
|
475
|
+
(0, vitest_1.it)('generates root layout without TypeScript types', () => {
|
|
476
|
+
const template = (0, templates_1.getRootLayoutWithGenerateMetadata)(false);
|
|
477
|
+
(0, vitest_1.expect)(template).toMatchInlineSnapshot(`
|
|
478
|
+
"// This file was generated by the Sentry wizard because we couldn't find a root layout file.
|
|
479
|
+
import * as Sentry from '@sentry/nextjs';
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
export function generateMetadata() {
|
|
483
|
+
return {
|
|
484
|
+
other: {
|
|
485
|
+
...Sentry.getTraceData(),
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
export default function RootLayout({
|
|
491
|
+
children,
|
|
492
|
+
}) {
|
|
493
|
+
return (
|
|
494
|
+
<html lang="en">
|
|
495
|
+
<body>{children}</body>
|
|
496
|
+
</html>
|
|
497
|
+
)
|
|
498
|
+
}
|
|
499
|
+
"
|
|
500
|
+
`);
|
|
501
|
+
});
|
|
502
|
+
});
|
|
503
|
+
(0, vitest_1.describe)('getSentryExamplePageContents', () => {
|
|
504
|
+
(0, vitest_1.it)('generates example page with TypeScript types', () => {
|
|
505
|
+
const template = (0, templates_1.getSentryExamplePageContents)({
|
|
506
|
+
selfHosted: false,
|
|
507
|
+
sentryUrl: 'https://sentry.io',
|
|
508
|
+
orgSlug: 'my-org',
|
|
509
|
+
projectId: '123',
|
|
510
|
+
useClient: true,
|
|
511
|
+
isTypeScript: true,
|
|
512
|
+
});
|
|
513
|
+
(0, vitest_1.expect)(template).toContain('"use client";');
|
|
514
|
+
(0, vitest_1.expect)(template).toContain('constructor(message: string | undefined)');
|
|
515
|
+
(0, vitest_1.expect)(template).toContain('class SentryExampleFrontendError extends Error');
|
|
516
|
+
});
|
|
517
|
+
(0, vitest_1.it)('generates example page without TypeScript types', () => {
|
|
518
|
+
const template = (0, templates_1.getSentryExamplePageContents)({
|
|
519
|
+
selfHosted: false,
|
|
520
|
+
sentryUrl: 'https://sentry.io',
|
|
521
|
+
orgSlug: 'my-org',
|
|
522
|
+
projectId: '123',
|
|
523
|
+
useClient: true,
|
|
524
|
+
isTypeScript: false,
|
|
525
|
+
});
|
|
526
|
+
(0, vitest_1.expect)(template).toContain('"use client";');
|
|
527
|
+
(0, vitest_1.expect)(template).toContain('constructor(message)');
|
|
528
|
+
(0, vitest_1.expect)(template).toContain('class SentryExampleFrontendError extends Error');
|
|
529
|
+
});
|
|
530
|
+
(0, vitest_1.it)('generates example page without useClient directive', () => {
|
|
531
|
+
const template = (0, templates_1.getSentryExamplePageContents)({
|
|
532
|
+
selfHosted: false,
|
|
533
|
+
sentryUrl: 'https://sentry.io',
|
|
534
|
+
orgSlug: 'my-org',
|
|
535
|
+
projectId: '123',
|
|
536
|
+
useClient: false,
|
|
537
|
+
isTypeScript: true,
|
|
538
|
+
});
|
|
539
|
+
(0, vitest_1.expect)(template).not.toContain('"use client";');
|
|
540
|
+
(0, vitest_1.expect)(template).toContain('https://my-org.sentry.io/issues/?project=123');
|
|
541
|
+
});
|
|
542
|
+
});
|
|
543
|
+
(0, vitest_1.describe)('getSentryExamplePagesDirApiRoute', () => {
|
|
544
|
+
(0, vitest_1.it)('generates Pages Router API route with TypeScript types', () => {
|
|
545
|
+
const template = (0, templates_1.getSentryExamplePagesDirApiRoute)({
|
|
546
|
+
isTypeScript: true,
|
|
547
|
+
});
|
|
548
|
+
(0, vitest_1.expect)(template).toContain('constructor(message: string | undefined)');
|
|
549
|
+
(0, vitest_1.expect)(template).toContain('class SentryExampleAPIError extends Error');
|
|
550
|
+
(0, vitest_1.expect)(template).toContain('export default function handler(_req, res)');
|
|
551
|
+
});
|
|
552
|
+
(0, vitest_1.it)('generates Pages Router API route without TypeScript types', () => {
|
|
553
|
+
const template = (0, templates_1.getSentryExamplePagesDirApiRoute)({
|
|
554
|
+
isTypeScript: false,
|
|
555
|
+
});
|
|
556
|
+
(0, vitest_1.expect)(template).toContain('constructor(message)');
|
|
557
|
+
(0, vitest_1.expect)(template).toContain('class SentryExampleAPIError extends Error');
|
|
558
|
+
(0, vitest_1.expect)(template).toContain('export default function handler(_req, res)');
|
|
559
|
+
});
|
|
560
|
+
});
|
|
561
|
+
(0, vitest_1.describe)('getSentryExampleAppDirApiRoute', () => {
|
|
562
|
+
(0, vitest_1.it)('generates App Router API route with TypeScript types', () => {
|
|
563
|
+
const template = (0, templates_1.getSentryExampleAppDirApiRoute)({
|
|
564
|
+
isTypeScript: true,
|
|
565
|
+
});
|
|
566
|
+
(0, vitest_1.expect)(template).toContain('constructor(message: string | undefined)');
|
|
567
|
+
(0, vitest_1.expect)(template).toContain('class SentryExampleAPIError extends Error');
|
|
568
|
+
(0, vitest_1.expect)(template).toContain('export function GET()');
|
|
569
|
+
(0, vitest_1.expect)(template).toContain('export const dynamic = "force-dynamic";');
|
|
570
|
+
});
|
|
571
|
+
(0, vitest_1.it)('generates App Router API route without TypeScript types', () => {
|
|
572
|
+
const template = (0, templates_1.getSentryExampleAppDirApiRoute)({
|
|
573
|
+
isTypeScript: false,
|
|
574
|
+
});
|
|
575
|
+
(0, vitest_1.expect)(template).toContain('constructor(message)');
|
|
576
|
+
(0, vitest_1.expect)(template).toContain('class SentryExampleAPIError extends Error');
|
|
577
|
+
(0, vitest_1.expect)(template).toContain('export function GET()');
|
|
578
|
+
(0, vitest_1.expect)(template).toContain('export const dynamic = "force-dynamic";');
|
|
579
|
+
});
|
|
580
|
+
});
|
|
405
581
|
});
|
|
406
582
|
//# sourceMappingURL=templates.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/nextjs/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,0DAKoC;AAEpC,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,iBAAQ,EAAC,sCAAsC,EAAE,GAAG,EAAE;QACpD,IAAA,WAAE,EAAC,+DAA+D,EAAE,GAAG,EAAE;YACvE,MAAM,QAAQ,GAAG,IAAA,gDAAoC,EAAC,QAAQ,EAAE;gBAC9D,WAAW,EAA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QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCtC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,iBAAQ,EAAC,eAAe,EAAE,GAAG,EAAE;QAC7B,IAAA,WAAE,EAAC,8CAA8C,EAAE,GAAG,EAAE;YACtD,IAAA,eAAM,EAAC,IAAA,yBAAa,EAAC,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;OAqBjD,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,IAAA,WAAE,EAAC,iDAAiD,EAAE,GAAG,EAAE;YACzD,IAAA,eAAM,EAAC,IAAA,yBAAa,EAAC,KAAK,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;OAmBlD,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n getRootLayout,\n getSentryServersideConfigContents,\n getInstrumentationClientFileContents,\n getWithSentryConfigOptionsTemplate,\n} from '../../src/nextjs/templates';\n\ndescribe('Next.js code templates', () => {\n describe('getInstrumentationClientFileContents', () => {\n it('generates client-side Sentry config with all features enabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Define how likely Replay events are sampled.\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n\n it('generates client-side Sentry config with performance monitoring disabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: false,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n\n // Define how likely Replay events are sampled.\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n\n it('generates client-side Sentry config with session replay disabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: true,\n replay: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n });\n\n describe('getSentryServersideConfigContents', () => {\n describe('server-side', () => {\n it('generates server-side Sentry config with all features enabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with performance monitoring disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: false,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with spotlight disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n\n describe('edge', () => {\n it('generates edge Sentry config with all features enabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'edge', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates edge Sentry config with performance monitoring disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'edge', {\n performance: false,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n });\n\n describe('getWithSentryConfigOptionsTemplate', () => {\n it('generates options for SaaS', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n sentryUrl: 'https://dont-use-this-url.com',\n tunnelRoute: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n\n it('generates options for self-hosted', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: true,\n sentryUrl: 'https://my-sentry.com',\n tunnelRoute: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n sentryUrl: \"https://my-sentry.com\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n\n it('comments out tunnelRoute if `tunnelRoute` option is disabled', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n sentryUrl: 'https://dont-use-this-url.com',\n tunnelRoute: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n // tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n });\n\n describe('getRootLayout', () => {\n it('generates a root layout component with types', () => {\n expect(getRootLayout(true)).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n // You can delete this file at any time.\n\n export const metadata = {\n title: 'Sentry NextJS Example',\n description: 'Generated by Sentry',\n }\n\n export default function RootLayout({\n children,\n }: {\n children: React.ReactNode\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n it('generates a root layout component without types', () => {\n expect(getRootLayout(false)).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n // You can delete this file at any time.\n\n export const metadata = {\n title: 'Sentry NextJS Example',\n description: 'Generated by Sentry',\n }\n\n export default function RootLayout({\n children,\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"templates.test.js","sourceRoot":"","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AS,CAAC,yCAAyC,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,yDAAyD,EAAE,GAAG,EAAE;YACjE,MAAM,QAAQ,GAAG,IAAA,0CAA8B,EAAC;gBAC9C,YAAY,EAAE,KAAK;aACpB,CAAC,CAAC;YAEH,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;YACnD,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,2CAA2C,CAAC,CAAC;YACxE,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;YACpD,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,yCAAyC,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n getRootLayout,\n getSentryServersideConfigContents,\n getInstrumentationClientFileContents,\n getWithSentryConfigOptionsTemplate,\n getGenerateMetadataSnippet,\n getRootLayoutWithGenerateMetadata,\n getSentryExamplePageContents,\n getSentryExamplePagesDirApiRoute,\n getSentryExampleAppDirApiRoute,\n} from '../../src/nextjs/templates';\n\ndescribe('Next.js code templates', () => {\n describe('getInstrumentationClientFileContents', () => {\n it('generates client-side Sentry config with all features enabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Define how likely Replay events are sampled.\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n\n it('generates client-side Sentry config with performance monitoring disabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: false,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n\n // Define how likely Replay events are sampled.\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n\n it('generates client-side Sentry config with session replay disabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: true,\n replay: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n });\n\n describe('getSentryServersideConfigContents', () => {\n describe('server-side', () => {\n it('generates server-side Sentry config with all features enabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with performance monitoring disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: false,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with spotlight disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n\n describe('edge', () => {\n it('generates edge Sentry config with all features enabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'edge', {\n performance: true,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates edge Sentry config with performance monitoring disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'edge', {\n performance: false,\n replay: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n });\n\n describe('getWithSentryConfigOptionsTemplate', () => {\n it('generates options for SaaS', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n sentryUrl: 'https://dont-use-this-url.com',\n tunnelRoute: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n\n it('generates options for self-hosted', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: true,\n sentryUrl: 'https://my-sentry.com',\n tunnelRoute: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n sentryUrl: \"https://my-sentry.com\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n\n it('comments out tunnelRoute if `tunnelRoute` option is disabled', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n sentryUrl: 'https://dont-use-this-url.com',\n tunnelRoute: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n // tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n });\n\n describe('getRootLayout', () => {\n it('generates a root layout component with types', () => {\n expect(getRootLayout(true)).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n // You can delete this file at any time.\n\n export const metadata = {\n title: 'Sentry NextJS Example',\n description: 'Generated by Sentry',\n }\n\n export default function RootLayout({\n children,\n }: {\n children: React.ReactNode\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n it('generates a root layout component without types', () => {\n expect(getRootLayout(false)).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n // You can delete this file at any time.\n\n export const metadata = {\n title: 'Sentry NextJS Example',\n description: 'Generated by Sentry',\n }\n\n export default function RootLayout({\n children,\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n });\n\n describe('getGenerateMetadataSnippet', () => {\n it('generates metadata snippet with TypeScript types', () => {\n const template = getGenerateMetadataSnippet(true);\n\n expect(template).toMatchInlineSnapshot(`\n\"\n import * as Sentry from '@sentry/nextjs';\n import type { Metadata } from 'next';\n\n // Add or edit your \"generateMetadata\" to include the Sentry trace data:\n export function generateMetadata(): Metadata {\n return {\n // ... your existing metadata\n other: {\n ...Sentry.getTraceData()\n }\n };\n }\n\"\n`);\n });\n\n it('generates metadata snippet without TypeScript types', () => {\n const template = getGenerateMetadataSnippet(false);\n\n expect(template).toMatchInlineSnapshot(`\n\"\n import * as Sentry from '@sentry/nextjs';\n \n\n // Add or edit your \"generateMetadata\" to include the Sentry trace data:\n export function generateMetadata() {\n return {\n // ... your existing metadata\n other: {\n ...Sentry.getTraceData()\n }\n };\n }\n\"\n `);\n });\n });\n\n describe('getRootLayoutWithGenerateMetadata', () => {\n it('generates root layout with TypeScript types', () => {\n const template = getRootLayoutWithGenerateMetadata(true);\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n import * as Sentry from '@sentry/nextjs';\n import type { Metadata } from 'next';\n\n export function generateMetadata(): Metadata {\n return {\n other: {\n ...Sentry.getTraceData(),\n }\n }\n };\n\n export default function RootLayout({\n children,\n }: {\n children: React.ReactNode\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n\n it('generates root layout without TypeScript types', () => {\n const template = getRootLayoutWithGenerateMetadata(false);\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n import * as Sentry from '@sentry/nextjs';\n\n \n export function generateMetadata() {\n return {\n other: {\n ...Sentry.getTraceData(),\n }\n }\n };\n\n export default function RootLayout({\n children,\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n });\n\n describe('getSentryExamplePageContents', () => {\n it('generates example page with TypeScript types', () => {\n const template = getSentryExamplePageContents({\n selfHosted: false,\n sentryUrl: 'https://sentry.io',\n orgSlug: 'my-org',\n projectId: '123',\n useClient: true,\n isTypeScript: true,\n });\n\n expect(template).toContain('\"use client\";');\n expect(template).toContain('constructor(message: string | undefined)');\n expect(template).toContain(\n 'class SentryExampleFrontendError extends Error',\n );\n });\n\n it('generates example page without TypeScript types', () => {\n const template = getSentryExamplePageContents({\n selfHosted: false,\n sentryUrl: 'https://sentry.io',\n orgSlug: 'my-org',\n projectId: '123',\n useClient: true,\n isTypeScript: false,\n });\n\n expect(template).toContain('\"use client\";');\n expect(template).toContain('constructor(message)');\n expect(template).toContain(\n 'class SentryExampleFrontendError extends Error',\n );\n });\n\n it('generates example page without useClient directive', () => {\n const template = getSentryExamplePageContents({\n selfHosted: false,\n sentryUrl: 'https://sentry.io',\n orgSlug: 'my-org',\n projectId: '123',\n useClient: false,\n isTypeScript: true,\n });\n\n expect(template).not.toContain('\"use client\";');\n expect(template).toContain(\n 'https://my-org.sentry.io/issues/?project=123',\n );\n });\n });\n\n describe('getSentryExamplePagesDirApiRoute', () => {\n it('generates Pages Router API route with TypeScript types', () => {\n const template = getSentryExamplePagesDirApiRoute({\n isTypeScript: true,\n });\n\n expect(template).toContain('constructor(message: string | undefined)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export default function handler(_req, res)');\n });\n\n it('generates Pages Router API route without TypeScript types', () => {\n const template = getSentryExamplePagesDirApiRoute({\n isTypeScript: false,\n });\n\n expect(template).toContain('constructor(message)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export default function handler(_req, res)');\n });\n });\n\n describe('getSentryExampleAppDirApiRoute', () => {\n it('generates App Router API route with TypeScript types', () => {\n const template = getSentryExampleAppDirApiRoute({\n isTypeScript: true,\n });\n\n expect(template).toContain('constructor(message: string | undefined)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export function GET()');\n expect(template).toContain('export const dynamic = \"force-dynamic\";');\n });\n\n it('generates App Router API route without TypeScript types', () => {\n const template = getSentryExampleAppDirApiRoute({\n isTypeScript: false,\n });\n\n expect(template).toContain('constructor(message)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export function GET()');\n expect(template).toContain('export const dynamic = \"force-dynamic\";');\n });\n });\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const vitest_1 = require("vitest");
|
|
27
|
+
const fs = __importStar(require("fs"));
|
|
28
|
+
const utils_1 = require("../../src/nextjs/utils");
|
|
29
|
+
vitest_1.vi.mock('fs', () => ({
|
|
30
|
+
existsSync: vitest_1.vi.fn(),
|
|
31
|
+
lstatSync: vitest_1.vi.fn(),
|
|
32
|
+
}));
|
|
33
|
+
(0, vitest_1.describe)('Next.js Utils', () => {
|
|
34
|
+
(0, vitest_1.describe)('getNextJsVersionBucket', () => {
|
|
35
|
+
(0, vitest_1.it)('returns "none" for undefined version', () => {
|
|
36
|
+
(0, vitest_1.expect)((0, utils_1.getNextJsVersionBucket)(undefined)).toBe('none');
|
|
37
|
+
});
|
|
38
|
+
(0, vitest_1.it)('returns "<11.0.0" for versions below 11', () => {
|
|
39
|
+
(0, vitest_1.expect)((0, utils_1.getNextJsVersionBucket)('10.0.0')).toBe('<11.0.0');
|
|
40
|
+
});
|
|
41
|
+
(0, vitest_1.it)('returns major version for versions 11 and above', () => {
|
|
42
|
+
(0, vitest_1.expect)((0, utils_1.getNextJsVersionBucket)('11.0.0')).toBe('11.x');
|
|
43
|
+
(0, vitest_1.expect)((0, utils_1.getNextJsVersionBucket)('11.2.5')).toBe('11.x');
|
|
44
|
+
(0, vitest_1.expect)((0, utils_1.getNextJsVersionBucket)('13.5.2')).toBe('13.x');
|
|
45
|
+
(0, vitest_1.expect)((0, utils_1.getNextJsVersionBucket)('14.0.0')).toBe('14.x');
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
(0, vitest_1.describe)('getMaybeAppDirLocation', () => {
|
|
49
|
+
const mockCwd = '/mock/cwd';
|
|
50
|
+
let originalCwd;
|
|
51
|
+
(0, vitest_1.beforeEach)(() => {
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
53
|
+
originalCwd = process.cwd;
|
|
54
|
+
process.cwd = vitest_1.vi.fn(() => mockCwd);
|
|
55
|
+
vitest_1.vi.clearAllMocks();
|
|
56
|
+
});
|
|
57
|
+
(0, vitest_1.afterEach)(() => {
|
|
58
|
+
process.cwd = originalCwd;
|
|
59
|
+
});
|
|
60
|
+
(0, vitest_1.it)('returns ["app"] when app directory exists in root', () => {
|
|
61
|
+
fs.existsSync.mockImplementation((filePath) => {
|
|
62
|
+
return filePath === '/mock/cwd/app';
|
|
63
|
+
});
|
|
64
|
+
fs.lstatSync.mockImplementation((filePath) => ({
|
|
65
|
+
isDirectory: () => filePath === '/mock/cwd/app',
|
|
66
|
+
}));
|
|
67
|
+
(0, vitest_1.expect)((0, utils_1.getMaybeAppDirLocation)()).toEqual(['app']);
|
|
68
|
+
});
|
|
69
|
+
(0, vitest_1.it)('returns ["src", "app"] when app directory exists in src', () => {
|
|
70
|
+
fs.existsSync.mockImplementation((filePath) => {
|
|
71
|
+
return filePath === '/mock/cwd/src/app';
|
|
72
|
+
});
|
|
73
|
+
fs.lstatSync.mockImplementation((filePath) => ({
|
|
74
|
+
isDirectory: () => filePath === '/mock/cwd/src/app',
|
|
75
|
+
}));
|
|
76
|
+
(0, vitest_1.expect)((0, utils_1.getMaybeAppDirLocation)()).toEqual(['src', 'app']);
|
|
77
|
+
});
|
|
78
|
+
(0, vitest_1.it)('returns undefined when no app directory exists', () => {
|
|
79
|
+
fs.existsSync.mockReturnValue(false);
|
|
80
|
+
(0, vitest_1.expect)((0, utils_1.getMaybeAppDirLocation)()).toBeUndefined();
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
(0, vitest_1.describe)('hasRootLayoutFile', () => {
|
|
84
|
+
(0, vitest_1.beforeEach)(() => {
|
|
85
|
+
vitest_1.vi.clearAllMocks();
|
|
86
|
+
});
|
|
87
|
+
(0, vitest_1.it)('returns true when layout file exists with any supported extension', () => {
|
|
88
|
+
const mockAppFolderPath = '/mock/app';
|
|
89
|
+
const supportedExtensions = ['jsx', 'tsx', 'js'];
|
|
90
|
+
supportedExtensions.forEach((ext) => {
|
|
91
|
+
fs.existsSync.mockImplementation((filePath) => {
|
|
92
|
+
return filePath === `/mock/app/layout.${ext}`;
|
|
93
|
+
});
|
|
94
|
+
(0, vitest_1.expect)((0, utils_1.hasRootLayoutFile)(mockAppFolderPath)).toBe(true);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
(0, vitest_1.it)('returns false when no layout file exists', () => {
|
|
98
|
+
const mockAppFolderPath = '/mock/app';
|
|
99
|
+
fs.existsSync.mockReturnValue(false);
|
|
100
|
+
(0, vitest_1.expect)((0, utils_1.hasRootLayoutFile)(mockAppFolderPath)).toBe(false);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
//# sourceMappingURL=utils.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.test.js","sourceRoot":"","sources":["../../../test/nextjs/utils.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAyE;AAEzE,uCAAyB;AACzB,kDAIgC;AAEhC,WAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IACnB,UAAU,EAAE,WAAE,CAAC,EAAE,EAAE;IACnB,SAAS,EAAE,WAAE,CAAC,EAAE,EAAE;CACnB,CAAC,CAAC,CAAC;AAEJ,IAAA,iBAAQ,EAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;QACtC,IAAA,WAAE,EAAC,sCAAsC,EAAE,GAAG,EAAE;YAC9C,IAAA,eAAM,EAAC,IAAA,8BAAsB,EAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,yCAAyC,EAAE,GAAG,EAAE;YACjD,IAAA,eAAM,EAAC,IAAA,8BAAsB,EAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,iDAAiD,EAAE,GAAG,EAAE;YACzD,IAAA,eAAM,EAAC,IAAA,8BAAsB,EAAC,QA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CAAC,kBAAkB,CAAC,CAAC,QAAgB,EAAE,EAAE;oBAC9D,OAAO,QAAQ,KAAK,oBAAoB,GAAG,EAAE,CAAC;gBAChD,CAAC,CAAC,CAAC;gBAEH,IAAA,eAAM,EAAC,IAAA,yBAAiB,EAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1D,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,0CAA0C,EAAE,GAAG,EAAE;YAClD,MAAM,iBAAiB,GAAG,WAAW,CAAC;YACrC,EAAE,CAAC,UAAmB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YAE/C,IAAA,eAAM,EAAC,IAAA,yBAAiB,EAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';\nimport type { Mock } from 'vitest';\nimport * as fs from 'fs';\nimport {\n getNextJsVersionBucket,\n getMaybeAppDirLocation,\n hasRootLayoutFile,\n} from '../../src/nextjs/utils';\n\nvi.mock('fs', () => ({\n existsSync: vi.fn(),\n lstatSync: vi.fn(),\n}));\n\ndescribe('Next.js Utils', () => {\n describe('getNextJsVersionBucket', () => {\n it('returns \"none\" for undefined version', () => {\n expect(getNextJsVersionBucket(undefined)).toBe('none');\n });\n\n it('returns \"<11.0.0\" for versions below 11', () => {\n expect(getNextJsVersionBucket('10.0.0')).toBe('<11.0.0');\n });\n\n it('returns major version for versions 11 and above', () => {\n expect(getNextJsVersionBucket('11.0.0')).toBe('11.x');\n expect(getNextJsVersionBucket('11.2.5')).toBe('11.x');\n expect(getNextJsVersionBucket('13.5.2')).toBe('13.x');\n expect(getNextJsVersionBucket('14.0.0')).toBe('14.x');\n });\n });\n\n describe('getMaybeAppDirLocation', () => {\n const mockCwd = '/mock/cwd';\n let originalCwd: () => string;\n\n beforeEach(() => {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n originalCwd = process.cwd;\n process.cwd = vi.fn(() => mockCwd);\n vi.clearAllMocks();\n });\n\n afterEach(() => {\n process.cwd = originalCwd;\n });\n\n it('returns [\"app\"] when app directory exists in root', () => {\n (fs.existsSync as Mock).mockImplementation((filePath: string) => {\n return filePath === '/mock/cwd/app';\n });\n (fs.lstatSync as Mock).mockImplementation((filePath: string) => ({\n isDirectory: () => filePath === '/mock/cwd/app',\n }));\n\n expect(getMaybeAppDirLocation()).toEqual(['app']);\n });\n\n it('returns [\"src\", \"app\"] when app directory exists in src', () => {\n (fs.existsSync as Mock).mockImplementation((filePath: string) => {\n return filePath === '/mock/cwd/src/app';\n });\n (fs.lstatSync as Mock).mockImplementation((filePath: string) => ({\n isDirectory: () => filePath === '/mock/cwd/src/app',\n }));\n\n expect(getMaybeAppDirLocation()).toEqual(['src', 'app']);\n });\n\n it('returns undefined when no app directory exists', () => {\n (fs.existsSync as Mock).mockReturnValue(false);\n\n expect(getMaybeAppDirLocation()).toBeUndefined();\n });\n });\n\n describe('hasRootLayoutFile', () => {\n beforeEach(() => {\n vi.clearAllMocks();\n });\n\n it('returns true when layout file exists with any supported extension', () => {\n const mockAppFolderPath = '/mock/app';\n const supportedExtensions = ['jsx', 'tsx', 'js'];\n\n supportedExtensions.forEach((ext) => {\n (fs.existsSync as Mock).mockImplementation((filePath: string) => {\n return filePath === `/mock/app/layout.${ext}`;\n });\n\n expect(hasRootLayoutFile(mockAppFolderPath)).toBe(true);\n });\n });\n\n it('returns false when no layout file exists', () => {\n const mockAppFolderPath = '/mock/app';\n (fs.existsSync as Mock).mockReturnValue(false);\n\n expect(hasRootLayoutFile(mockAppFolderPath)).toBe(false);\n });\n });\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const wrangler_1 = require("../../../src/sourcemaps/tools/wrangler");
|
|
4
|
+
const vitest_1 = require("vitest");
|
|
5
|
+
(0, vitest_1.describe)('getSentryCliCommand', () => {
|
|
6
|
+
(0, vitest_1.it)('returns correct command for SaaS', () => {
|
|
7
|
+
const command = (0, wrangler_1.getSentryCliCommand)({
|
|
8
|
+
selfHosted: false,
|
|
9
|
+
orgSlug: 'myOrg',
|
|
10
|
+
projectSlug: 'myProject',
|
|
11
|
+
url: 'https://sentry.io',
|
|
12
|
+
authToken: '_ignore',
|
|
13
|
+
outDir: 'dist',
|
|
14
|
+
});
|
|
15
|
+
(0, vitest_1.expect)(command).toBe("_SENTRY_RELEASE=$(sentry-cli releases propose-version) && sentry-cli releases new $_SENTRY_RELEASE --org=myOrg --project=myProject && sentry-cli sourcemaps upload --org=myOrg --project=myProject --release=$_SENTRY_RELEASE --strip-prefix 'dist/..' dist");
|
|
16
|
+
});
|
|
17
|
+
(0, vitest_1.it)('returns correct command for self-hosted', () => {
|
|
18
|
+
const command = (0, wrangler_1.getSentryCliCommand)({
|
|
19
|
+
selfHosted: true,
|
|
20
|
+
orgSlug: 'myOrg',
|
|
21
|
+
projectSlug: 'myProject',
|
|
22
|
+
url: 'https://santry.io',
|
|
23
|
+
authToken: '_ignore',
|
|
24
|
+
outDir: 'someplace',
|
|
25
|
+
});
|
|
26
|
+
(0, vitest_1.expect)(command).toBe("_SENTRY_RELEASE=$(sentry-cli releases propose-version) && sentry-cli --url https://santry.io releases new $_SENTRY_RELEASE --org=myOrg --project=myProject && sentry-cli --url https://santry.io sourcemaps upload --org=myOrg --project=myProject --release=$_SENTRY_RELEASE --strip-prefix 'someplace/..' someplace");
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
(0, vitest_1.describe)('safeInsertArgsToWranglerDeployCommand', () => {
|
|
30
|
+
(0, vitest_1.it)('correctly inserts args into default command', () => {
|
|
31
|
+
const newCommand = (0, wrangler_1.safeInsertArgsToWranglerDeployCommand)('wrangler deploy', 'dist');
|
|
32
|
+
(0, vitest_1.expect)(newCommand).toBe('wrangler deploy --outdir dist --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)');
|
|
33
|
+
});
|
|
34
|
+
vitest_1.it.each([
|
|
35
|
+
'--outdir someplace',
|
|
36
|
+
'--outdir=someplace',
|
|
37
|
+
'--outdir="./someplace"',
|
|
38
|
+
])('retains existing %s arg', (arg) => {
|
|
39
|
+
const newCommand = (0, wrangler_1.safeInsertArgsToWranglerDeployCommand)(`wrangler deploy ${arg}`, 'dist');
|
|
40
|
+
(0, vitest_1.expect)(newCommand).toBe(`wrangler deploy ${arg} --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)`);
|
|
41
|
+
});
|
|
42
|
+
vitest_1.it.each([
|
|
43
|
+
'--upload-source-maps',
|
|
44
|
+
'--upload-source-maps=true',
|
|
45
|
+
'--upload-source-maps true',
|
|
46
|
+
'--upload-source-maps=false',
|
|
47
|
+
'--upload-source-maps false',
|
|
48
|
+
])('retains existing %s arg', (arg) => {
|
|
49
|
+
const newCommand = (0, wrangler_1.safeInsertArgsToWranglerDeployCommand)(`wrangler deploy ${arg}`, 'dist');
|
|
50
|
+
(0, vitest_1.expect)(newCommand).toBe(`wrangler deploy ${arg} --outdir dist --var SENTRY_RELEASE:$(sentry-cli releases propose-version)`);
|
|
51
|
+
});
|
|
52
|
+
(0, vitest_1.it)('appends to the "wrangler deploy" command', () => {
|
|
53
|
+
const newCommand = (0, wrangler_1.safeInsertArgsToWranglerDeployCommand)('precheck && wrangler deploy --outdir dist --upload-source-maps --var SOMEVAR:someValue && postcheck', 'dist');
|
|
54
|
+
(0, vitest_1.expect)(newCommand).toBe('precheck && wrangler deploy --outdir dist --upload-source-maps --var SOMEVAR:someValue --var SENTRY_RELEASE:$(sentry-cli releases propose-version) && postcheck');
|
|
55
|
+
});
|
|
56
|
+
(0, vitest_1.it)('handles multiple wrangler commands', () => {
|
|
57
|
+
const newCommand = (0, wrangler_1.safeInsertArgsToWranglerDeployCommand)('wrangler whoami && wrangler deploy --outdir dist --upload-source-maps --var SOMEVAR:someValue && wrangler someothercommand', 'dist');
|
|
58
|
+
(0, vitest_1.expect)(newCommand).toBe('wrangler whoami && wrangler deploy --outdir dist --upload-source-maps --var SOMEVAR:someValue --var SENTRY_RELEASE:$(sentry-cli releases propose-version) && wrangler someothercommand');
|
|
59
|
+
});
|
|
60
|
+
(0, vitest_1.it)('handles wrangler deploy command with global args', () => {
|
|
61
|
+
const newCommand = (0, wrangler_1.safeInsertArgsToWranglerDeployCommand)('wrangler --version --env production deploy --outdir someplace', 'dist');
|
|
62
|
+
(0, vitest_1.expect)(newCommand).toBe('wrangler --version --env production deploy --outdir someplace --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)');
|
|
63
|
+
});
|
|
64
|
+
(0, vitest_1.it)('handles multiple commands and wrangler deploy command with global args', () => {
|
|
65
|
+
const newCommand = (0, wrangler_1.safeInsertArgsToWranglerDeployCommand)('notwrangler --version deploy && wrangler --version --env whoami && wrangler --version --env production deploy --outdir someplace', 'dist');
|
|
66
|
+
(0, vitest_1.expect)(newCommand).toBe('notwrangler --version deploy && wrangler --version --env whoami && wrangler --version --env production deploy --outdir someplace --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)');
|
|
67
|
+
});
|
|
68
|
+
vitest_1.it.each([
|
|
69
|
+
'notwrangler deploy',
|
|
70
|
+
'wrangler dev',
|
|
71
|
+
'wrangler dev && notwrangler deploy',
|
|
72
|
+
'wrangler dev ; notwrangler deploy',
|
|
73
|
+
'wrangler dev; notwrangler deploy',
|
|
74
|
+
'wrangler dev ;notwrangler deploy',
|
|
75
|
+
'wrangler --env dev dev && notwrangler deploy',
|
|
76
|
+
'some completely different command',
|
|
77
|
+
])('returns undefined if deploy command is not found', (command) => {
|
|
78
|
+
const newCommand = (0, wrangler_1.safeInsertArgsToWranglerDeployCommand)(command, 'dist');
|
|
79
|
+
(0, vitest_1.expect)(newCommand).toBeUndefined();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
(0, vitest_1.describe)('findOutDir', () => {
|
|
83
|
+
(0, vitest_1.it)('returns dist dir if no outdir arg is found', () => {
|
|
84
|
+
const outDir = (0, wrangler_1.findOutDir)('wrangler deploy');
|
|
85
|
+
(0, vitest_1.expect)(outDir).toBe(wrangler_1.DIST_DIR);
|
|
86
|
+
});
|
|
87
|
+
(0, vitest_1.it)('returns outdir arg if it is found', () => {
|
|
88
|
+
const outDir = (0, wrangler_1.findOutDir)('wrangler deploy --outdir someplace');
|
|
89
|
+
(0, vitest_1.expect)(outDir).toBe('someplace');
|
|
90
|
+
});
|
|
91
|
+
(0, vitest_1.it)('handles --outdir "./someplace"', () => {
|
|
92
|
+
const outDir = (0, wrangler_1.findOutDir)('wrangler deploy --outdir "./someplace"');
|
|
93
|
+
(0, vitest_1.expect)(outDir).toBe('./someplace');
|
|
94
|
+
});
|
|
95
|
+
(0, vitest_1.it)('handles --outdir=someplace', () => {
|
|
96
|
+
const outDir = (0, wrangler_1.findOutDir)('wrangler deploy --outdir=someplace');
|
|
97
|
+
(0, vitest_1.expect)(outDir).toBe('someplace');
|
|
98
|
+
});
|
|
99
|
+
(0, vitest_1.it)("handles --outdir='./someplace'", () => {
|
|
100
|
+
const outDir = (0, wrangler_1.findOutDir)('wrangler deploy --outdir="./someplace"');
|
|
101
|
+
(0, vitest_1.expect)(outDir).toBe('./someplace');
|
|
102
|
+
});
|
|
103
|
+
(0, vitest_1.it)('returns dist dir if deploy command is not found', () => {
|
|
104
|
+
const outDir = (0, wrangler_1.findOutDir)('wrangler --environment testing dev --outdir someplace');
|
|
105
|
+
(0, vitest_1.expect)(outDir).toBe(wrangler_1.DIST_DIR);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
(0, vitest_1.describe)('getWranglerDeployCommand', () => {
|
|
109
|
+
(0, vitest_1.it)('returns the deploy command', () => {
|
|
110
|
+
const deployCommand = (0, wrangler_1.getWranglerDeployCommand)('wrangler deploy --outdir someplace');
|
|
111
|
+
(0, vitest_1.expect)(deployCommand).toBe('wrangler deploy --outdir someplace');
|
|
112
|
+
});
|
|
113
|
+
(0, vitest_1.it)('returns undefined if deploy command is not found', () => {
|
|
114
|
+
const deployCommand = (0, wrangler_1.getWranglerDeployCommand)('wrangler --environment testing dev --outdir someplace');
|
|
115
|
+
(0, vitest_1.expect)(deployCommand).toBeUndefined();
|
|
116
|
+
});
|
|
117
|
+
vitest_1.it.each([
|
|
118
|
+
'wrangler deploy --outdir someplace && some other command',
|
|
119
|
+
'wrangler deploy --outdir someplace || some other command',
|
|
120
|
+
'wrangler deploy --outdir someplace ; some other command',
|
|
121
|
+
'wrangler deploy --outdir someplace && some other command || some other command',
|
|
122
|
+
'yarn precheck && wrangler deploy --outdir someplace && some other command',
|
|
123
|
+
'yarn precheck || wrangler deploy --outdir someplace && some other command',
|
|
124
|
+
'npm run test; wrangler deploy --outdir someplace && some other command',
|
|
125
|
+
'npm run test; wrangler version > text && wrangler deploy --outdir someplace && some other command',
|
|
126
|
+
'wrangler deploy --outdir someplace > deployment.txt',
|
|
127
|
+
])('returns the deploy command for `%s`', (command) => {
|
|
128
|
+
const deployCommand = (0, wrangler_1.getWranglerDeployCommand)(command)?.trim();
|
|
129
|
+
(0, vitest_1.expect)(deployCommand).toBe('wrangler deploy --outdir someplace');
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
//# sourceMappingURL=wrangler.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrangler.test.js","sourceRoot":"","sources":["../../../../test/sourcemaps/tools/wrangler.test.ts"],"names":[],"mappings":";;AAAA,qEAMgD;AAChD,mCAA8C;AAE9C,IAAA,iBAAQ,EAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAA,WAAE,EAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,OAAO,G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CAAC,qCAAqC,EAAE,CAAC,OAAO,EAAE,EAAE;QACpD,MAAM,aAAa,GAAG,IAAA,mCAAwB,EAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC;QAEhE,IAAA,eAAM,EAAC,aAAa,CAAC,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\n DIST_DIR,\n findOutDir,\n getSentryCliCommand,\n getWranglerDeployCommand,\n safeInsertArgsToWranglerDeployCommand,\n} from '../../../src/sourcemaps/tools/wrangler';\nimport { describe, expect, it } from 'vitest';\n\ndescribe('getSentryCliCommand', () => {\n it('returns correct command for SaaS', () => {\n const command = getSentryCliCommand({\n selfHosted: false,\n orgSlug: 'myOrg',\n projectSlug: 'myProject',\n url: 'https://sentry.io',\n authToken: '_ignore',\n outDir: 'dist',\n });\n\n expect(command).toBe(\n \"_SENTRY_RELEASE=$(sentry-cli releases propose-version) && sentry-cli releases new $_SENTRY_RELEASE --org=myOrg --project=myProject && sentry-cli sourcemaps upload --org=myOrg --project=myProject --release=$_SENTRY_RELEASE --strip-prefix 'dist/..' dist\",\n );\n });\n\n it('returns correct command for self-hosted', () => {\n const command = getSentryCliCommand({\n selfHosted: true,\n orgSlug: 'myOrg',\n projectSlug: 'myProject',\n url: 'https://santry.io',\n authToken: '_ignore',\n outDir: 'someplace',\n });\n\n expect(command).toBe(\n \"_SENTRY_RELEASE=$(sentry-cli releases propose-version) && sentry-cli --url https://santry.io releases new $_SENTRY_RELEASE --org=myOrg --project=myProject && sentry-cli --url https://santry.io sourcemaps upload --org=myOrg --project=myProject --release=$_SENTRY_RELEASE --strip-prefix 'someplace/..' someplace\",\n );\n });\n});\n\ndescribe('safeInsertArgsToWranglerDeployCommand', () => {\n it('correctly inserts args into default command', () => {\n const newCommand = safeInsertArgsToWranglerDeployCommand(\n 'wrangler deploy',\n 'dist',\n );\n\n expect(newCommand).toBe(\n 'wrangler deploy --outdir dist --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)',\n );\n });\n\n it.each([\n '--outdir someplace',\n '--outdir=someplace',\n '--outdir=\"./someplace\"',\n ])('retains existing %s arg', (arg) => {\n const newCommand = safeInsertArgsToWranglerDeployCommand(\n `wrangler deploy ${arg}`,\n 'dist',\n );\n\n expect(newCommand).toBe(\n `wrangler deploy ${arg} --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)`,\n );\n });\n\n it.each([\n '--upload-source-maps',\n '--upload-source-maps=true',\n '--upload-source-maps true',\n '--upload-source-maps=false',\n '--upload-source-maps false',\n ])('retains existing %s arg', (arg) => {\n const newCommand = safeInsertArgsToWranglerDeployCommand(\n `wrangler deploy ${arg}`,\n 'dist',\n );\n\n expect(newCommand).toBe(\n `wrangler deploy ${arg} --outdir dist --var SENTRY_RELEASE:$(sentry-cli releases propose-version)`,\n );\n });\n\n it('appends to the \"wrangler deploy\" command', () => {\n const newCommand = safeInsertArgsToWranglerDeployCommand(\n 'precheck && wrangler deploy --outdir dist --upload-source-maps --var SOMEVAR:someValue && postcheck',\n 'dist',\n );\n\n expect(newCommand).toBe(\n 'precheck && wrangler deploy --outdir dist --upload-source-maps --var SOMEVAR:someValue --var SENTRY_RELEASE:$(sentry-cli releases propose-version) && postcheck',\n );\n });\n\n it('handles multiple wrangler commands', () => {\n const newCommand = safeInsertArgsToWranglerDeployCommand(\n 'wrangler whoami && wrangler deploy --outdir dist --upload-source-maps --var SOMEVAR:someValue && wrangler someothercommand',\n 'dist',\n );\n\n expect(newCommand).toBe(\n 'wrangler whoami && wrangler deploy --outdir dist --upload-source-maps --var SOMEVAR:someValue --var SENTRY_RELEASE:$(sentry-cli releases propose-version) && wrangler someothercommand',\n );\n });\n\n it('handles wrangler deploy command with global args', () => {\n const newCommand = safeInsertArgsToWranglerDeployCommand(\n 'wrangler --version --env production deploy --outdir someplace',\n 'dist',\n );\n\n expect(newCommand).toBe(\n 'wrangler --version --env production deploy --outdir someplace --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)',\n );\n });\n\n it('handles multiple commands and wrangler deploy command with global args', () => {\n const newCommand = safeInsertArgsToWranglerDeployCommand(\n 'notwrangler --version deploy && wrangler --version --env whoami && wrangler --version --env production deploy --outdir someplace',\n 'dist',\n );\n\n expect(newCommand).toBe(\n 'notwrangler --version deploy && wrangler --version --env whoami && wrangler --version --env production deploy --outdir someplace --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)',\n );\n });\n\n it.each([\n 'notwrangler deploy',\n 'wrangler dev',\n 'wrangler dev && notwrangler deploy',\n 'wrangler dev ; notwrangler deploy',\n 'wrangler dev; notwrangler deploy',\n 'wrangler dev ;notwrangler deploy',\n 'wrangler --env dev dev && notwrangler deploy',\n 'some completely different command',\n ])('returns undefined if deploy command is not found', (command) => {\n const newCommand = safeInsertArgsToWranglerDeployCommand(command, 'dist');\n\n expect(newCommand).toBeUndefined();\n });\n});\n\ndescribe('findOutDir', () => {\n it('returns dist dir if no outdir arg is found', () => {\n const outDir = findOutDir('wrangler deploy');\n\n expect(outDir).toBe(DIST_DIR);\n });\n\n it('returns outdir arg if it is found', () => {\n const outDir = findOutDir('wrangler deploy --outdir someplace');\n\n expect(outDir).toBe('someplace');\n });\n\n it('handles --outdir \"./someplace\"', () => {\n const outDir = findOutDir('wrangler deploy --outdir \"./someplace\"');\n\n expect(outDir).toBe('./someplace');\n });\n\n it('handles --outdir=someplace', () => {\n const outDir = findOutDir('wrangler deploy --outdir=someplace');\n\n expect(outDir).toBe('someplace');\n });\n\n it(\"handles --outdir='./someplace'\", () => {\n const outDir = findOutDir('wrangler deploy --outdir=\"./someplace\"');\n\n expect(outDir).toBe('./someplace');\n });\n\n it('returns dist dir if deploy command is not found', () => {\n const outDir = findOutDir(\n 'wrangler --environment testing dev --outdir someplace',\n );\n\n expect(outDir).toBe(DIST_DIR);\n });\n});\n\ndescribe('getWranglerDeployCommand', () => {\n it('returns the deploy command', () => {\n const deployCommand = getWranglerDeployCommand(\n 'wrangler deploy --outdir someplace',\n );\n\n expect(deployCommand).toBe('wrangler deploy --outdir someplace');\n });\n\n it('returns undefined if deploy command is not found', () => {\n const deployCommand = getWranglerDeployCommand(\n 'wrangler --environment testing dev --outdir someplace',\n );\n\n expect(deployCommand).toBeUndefined();\n });\n\n it.each([\n 'wrangler deploy --outdir someplace && some other command',\n 'wrangler deploy --outdir someplace || some other command',\n 'wrangler deploy --outdir someplace ; some other command',\n 'wrangler deploy --outdir someplace && some other command || some other command',\n 'yarn precheck && wrangler deploy --outdir someplace && some other command',\n 'yarn precheck || wrangler deploy --outdir someplace && some other command',\n 'npm run test; wrangler deploy --outdir someplace && some other command',\n 'npm run test; wrangler version > text && wrangler deploy --outdir someplace && some other command',\n 'wrangler deploy --outdir someplace > deployment.txt',\n ])('returns the deploy command for `%s`', (command) => {\n const deployCommand = getWranglerDeployCommand(command)?.trim();\n\n expect(deployCommand).toBe('wrangler deploy --outdir someplace');\n });\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/wizard",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"homepage": "https://github.com/getsentry/sentry-wizard",
|
|
5
5
|
"repository": "https://github.com/getsentry/sentry-wizard",
|
|
6
6
|
"description": "Sentry wizard helping you to configure your project",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"@typescript-eslint/eslint-plugin": "^5.13.0",
|
|
58
58
|
"@typescript-eslint/parser": "^5.13.0",
|
|
59
59
|
"@vitest/coverage-v8": "3.0.9",
|
|
60
|
+
"clifty": "0.2.7",
|
|
60
61
|
"dotenv": "^16.4.5",
|
|
61
62
|
"eslint": "^8.18.0",
|
|
62
63
|
"eslint-config-prettier": "^8.3.0",
|