@sentry/wizard 6.8.0 → 6.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/e2e-tests/tests/sveltekit-hooks.test.js +70 -84
  3. package/dist/e2e-tests/tests/sveltekit-hooks.test.js.map +1 -1
  4. package/dist/e2e-tests/tests/sveltekit-tracing.test.js +3 -0
  5. package/dist/e2e-tests/tests/sveltekit-tracing.test.js.map +1 -1
  6. package/dist/src/apple/fastlane.js +3 -1
  7. package/dist/src/apple/fastlane.js.map +1 -1
  8. package/dist/src/apple/templates.js +1 -1
  9. package/dist/src/apple/templates.js.map +1 -1
  10. package/dist/src/sveltekit/sdk-example.d.ts +1 -0
  11. package/dist/src/sveltekit/sdk-example.js +3 -1
  12. package/dist/src/sveltekit/sdk-example.js.map +1 -1
  13. package/dist/src/sveltekit/sveltekit-wizard.js +4 -2
  14. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  15. package/dist/src/sveltekit/templates.d.ts +1 -0
  16. package/dist/src/sveltekit/templates.js +2 -4
  17. package/dist/src/sveltekit/templates.js.map +1 -1
  18. package/dist/src/sveltekit/utils.d.ts +1 -1
  19. package/dist/src/sveltekit/utils.js +45 -32
  20. package/dist/src/sveltekit/utils.js.map +1 -1
  21. package/dist/src/version.d.ts +1 -1
  22. package/dist/src/version.js +1 -1
  23. package/dist/src/version.js.map +1 -1
  24. package/dist/test/apple/fastfile.test.js +8 -8
  25. package/dist/test/apple/fastfile.test.js.map +1 -1
  26. package/dist/test/apple/templates.test.js +1 -1
  27. package/dist/test/apple/templates.test.js.map +1 -1
  28. package/dist/test/sveltekit/templates.test.js +478 -0
  29. package/dist/test/sveltekit/templates.test.js.map +1 -1
  30. package/dist/test/sveltekit/utils.test.d.ts +1 -0
  31. package/dist/test/sveltekit/utils.test.js +68 -0
  32. package/dist/test/sveltekit/utils.test.js.map +1 -0
  33. package/package.json +1 -1
@@ -517,4 +517,482 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
517
517
  `);
518
518
  });
519
519
  });
520
+ (0, vitest_1.describe)('getSentryExampleSveltePage', () => {
521
+ (0, vitest_1.it)('generates example page template with Svelte 5', () => {
522
+ const result = (0, templates_1.getSentryExampleSveltePage)({
523
+ selfHosted: false,
524
+ url: 'https://sentry.io',
525
+ orgSlug: 'test-org',
526
+ projectId: 'test-project',
527
+ isUsingSvelte5: true,
528
+ });
529
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
530
+ "<!--
531
+ This is just a very simple page with a button to throw an example error.
532
+ Feel free to delete this file and the entire sentry route.
533
+ -->
534
+
535
+ <script>
536
+ import * as Sentry from '@sentry/sveltekit';
537
+ import { onMount } from 'svelte';
538
+
539
+ let hasSentError = $state(false);
540
+ let isConnected = true;
541
+
542
+ onMount(async () => {
543
+ const result = await Sentry.diagnoseSdkConnectivity();
544
+ isConnected = result !== 'sentry-unreachable';
545
+ });
546
+
547
+ function getSentryData() {
548
+ Sentry.startSpan(
549
+ {
550
+ name: 'Example Frontend Span',
551
+ op: 'test'
552
+ },
553
+ async () => {
554
+ const res = await fetch('/sentry-example-page');
555
+ if (!res.ok) {
556
+ hasSentError = true;
557
+ throw new Error('Sentry Example Frontend Error');
558
+ }
559
+ }
560
+ );
561
+ }
562
+ </script>
563
+
564
+ <title>sentry-example-page</title>
565
+
566
+ <div>
567
+ <main>
568
+ <div class="flex-spacer"></div>
569
+ <svg height="40" width="40" fill="none" xmlns="http://www.w3.org/2000/svg">
570
+ <path d="M21.85 2.995a3.698 3.698 0 0 1 1.353 1.354l16.303 28.278a3.703 3.703 0 0 1-1.354 5.053 3.694 3.694 0 0 1-1.848.496h-3.828a31.149 31.149 0 0 0 0-3.09h3.815a.61.61 0 0 0 .537-.917L20.523 5.893a.61.61 0 0 0-1.057 0l-3.739 6.494a28.948 28.948 0 0 1 9.63 10.453 28.988 28.988 0 0 1 3.499 13.78v1.542h-9.852v-1.544a19.106 19.106 0 0 0-2.182-8.85 19.08 19.08 0 0 0-6.032-6.829l-1.85 3.208a15.377 15.377 0 0 1 6.382 12.484v1.542H3.696A3.694 3.694 0 0 1 0 34.473c0-.648.17-1.286.494-1.849l2.33-4.074a8.562 8.562 0 0 1 2.689 1.536L3.158 34.17a.611.611 0 0 0 .538.917h8.448a12.481 12.481 0 0 0-6.037-9.09l-1.344-.772 4.908-8.545 1.344.77a22.16 22.16 0 0 1 7.705 7.444 22.193 22.193 0 0 1 3.316 10.193h3.699a25.892 25.892 0 0 0-3.811-12.033 25.856 25.856 0 0 0-9.046-8.796l-1.344-.772 5.269-9.136a3.698 3.698 0 0 1 3.2-1.849c.648 0 1.285.17 1.847.495Z" fill="currentcolor"/>
571
+ </svg>
572
+ <h1>
573
+ sentry-example-page
574
+ </h1>
575
+
576
+ <p class="description">
577
+ Click the button below, and view the sample error on the Sentry <a target="_blank" href="https://test-org.sentry.io/issues/?project=test-project">Issues Page</a>.
578
+ For more details about setting up Sentry, <a target="_blank" href="https://docs.sentry.io/platforms/javascript/guides/sveltekit/">read our docs</a>.
579
+ </p>
580
+
581
+ <button
582
+ type="button"
583
+ onclick={getSentryData}
584
+ disabled={!isConnected}
585
+ >
586
+ <span>
587
+ Throw Sample Error
588
+ </span>
589
+ </button>
590
+
591
+ {#if hasSentError}
592
+ <p class="success">
593
+ Sample error was sent to Sentry.
594
+ </p>
595
+ {:else if !isConnected}
596
+ <div class="connectivity-error">
597
+ <p>It looks like network requests to Sentry are being blocked, which will prevent errors from being captured. Try disabling your ad-blocker to complete the test.</p>
598
+ </div>
599
+ {:else}
600
+ <div class="success_placeholder"></div>
601
+ {/if}
602
+ <div class="flex-spacer"></div>
603
+ </main>
604
+ </div>
605
+
606
+ <style>
607
+ :global(body) {
608
+ margin: 0;
609
+
610
+ @media (prefers-color-scheme: dark) {
611
+ color: #ededed;
612
+ background-color: #0a0a0a;
613
+ }
614
+ }
615
+
616
+ main {
617
+ display: flex;
618
+ min-height: 100vh;
619
+ flex-direction: column;
620
+ justify-content: center;
621
+ align-items: center;
622
+ box-sizing: border-box;
623
+ gap: 16px;
624
+ margin: 0;
625
+ padding: 16px;
626
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
627
+ }
628
+
629
+ h1 {
630
+ padding: 0px 4px;
631
+ border-radius: 4px;
632
+ background-color: rgba(24, 20, 35, 0.03);
633
+ font-family: monospace;
634
+ font-size: 20px;
635
+ line-height: 1.2;
636
+ }
637
+
638
+ p {
639
+ margin: 0;
640
+ font-size: 20px;
641
+ }
642
+
643
+ a {
644
+ color: #6341F0;
645
+ text-decoration: underline;
646
+ cursor: pointer;
647
+
648
+ @media (prefers-color-scheme: dark) {
649
+ color: #B3A1FF;
650
+ }
651
+ }
652
+
653
+ button {
654
+ border-radius: 8px;
655
+ color: white;
656
+ cursor: pointer;
657
+ background-color: #553DB8;
658
+ border: none;
659
+ padding: 0;
660
+ margin-top: 4px;
661
+
662
+ & > span {
663
+ display: inline-block;
664
+ padding: 12px 16px;
665
+ border-radius: inherit;
666
+ font-size: 20px;
667
+ font-weight: bold;
668
+ line-height: 1;
669
+ background-color: #7553FF;
670
+ border: 1px solid #553DB8;
671
+ transform: translateY(-4px);
672
+ }
673
+
674
+ &:hover > span {
675
+ transform: translateY(-8px);
676
+ }
677
+
678
+ &:active > span {
679
+ transform: translateY(0);
680
+ }
681
+
682
+ &:disabled {
683
+ cursor: not-allowed;
684
+ opacity: 0.6;
685
+
686
+ & > span {
687
+ transform: translateY(0);
688
+ border: none;
689
+ }
690
+ }
691
+ }
692
+
693
+ .description {
694
+ text-align: center;
695
+ color: #6E6C75;
696
+ max-width: 500px;
697
+ line-height: 1.5;
698
+ font-size: 20px;
699
+
700
+ @media (prefers-color-scheme: dark) {
701
+ color: #A49FB5;
702
+ }
703
+ }
704
+
705
+ .flex-spacer {
706
+ flex: 1;
707
+ }
708
+
709
+ .success {
710
+ padding: 12px 16px;
711
+ border-radius: 8px;
712
+ font-size: 20px;
713
+ line-height: 1;
714
+ background-color: #00F261;
715
+ border: 1px solid #00BF4D;
716
+ color: #181423;
717
+ }
718
+
719
+ .success_placeholder {
720
+ height: 46px;
721
+ }
722
+
723
+ .connectivity-error {
724
+ padding: 12px 16px;
725
+ background-color: #E50045;
726
+ border-radius: 8px;
727
+ width: 500px;
728
+ color: #FFFFFF;
729
+ border: 1px solid #A80033;
730
+ text-align: center;
731
+ margin: 0;
732
+ }
733
+
734
+ .connectivity-error a {
735
+ color: #FFFFFF;
736
+ text-decoration: underline;
737
+ }
738
+ </style>
739
+ "
740
+ `);
741
+ });
742
+ (0, vitest_1.it)('generates example page template pre-Svelte 5', () => {
743
+ const result = (0, templates_1.getSentryExampleSveltePage)({
744
+ selfHosted: false,
745
+ url: 'https://sentry.io',
746
+ orgSlug: 'test-org',
747
+ projectId: 'test-project',
748
+ isUsingSvelte5: false,
749
+ });
750
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
751
+ "<!--
752
+ This is just a very simple page with a button to throw an example error.
753
+ Feel free to delete this file and the entire sentry route.
754
+ -->
755
+
756
+ <script>
757
+ import * as Sentry from '@sentry/sveltekit';
758
+ import { onMount } from 'svelte';
759
+
760
+ let hasSentError = false;
761
+ let isConnected = true;
762
+
763
+ onMount(async () => {
764
+ const result = await Sentry.diagnoseSdkConnectivity();
765
+ isConnected = result !== 'sentry-unreachable';
766
+ });
767
+
768
+ function getSentryData() {
769
+ Sentry.startSpan(
770
+ {
771
+ name: 'Example Frontend Span',
772
+ op: 'test'
773
+ },
774
+ async () => {
775
+ const res = await fetch('/sentry-example-page');
776
+ if (!res.ok) {
777
+ hasSentError = true;
778
+ throw new Error('Sentry Example Frontend Error');
779
+ }
780
+ }
781
+ );
782
+ }
783
+ </script>
784
+
785
+ <title>sentry-example-page</title>
786
+
787
+ <div>
788
+ <main>
789
+ <div class="flex-spacer"></div>
790
+ <svg height="40" width="40" fill="none" xmlns="http://www.w3.org/2000/svg">
791
+ <path d="M21.85 2.995a3.698 3.698 0 0 1 1.353 1.354l16.303 28.278a3.703 3.703 0 0 1-1.354 5.053 3.694 3.694 0 0 1-1.848.496h-3.828a31.149 31.149 0 0 0 0-3.09h3.815a.61.61 0 0 0 .537-.917L20.523 5.893a.61.61 0 0 0-1.057 0l-3.739 6.494a28.948 28.948 0 0 1 9.63 10.453 28.988 28.988 0 0 1 3.499 13.78v1.542h-9.852v-1.544a19.106 19.106 0 0 0-2.182-8.85 19.08 19.08 0 0 0-6.032-6.829l-1.85 3.208a15.377 15.377 0 0 1 6.382 12.484v1.542H3.696A3.694 3.694 0 0 1 0 34.473c0-.648.17-1.286.494-1.849l2.33-4.074a8.562 8.562 0 0 1 2.689 1.536L3.158 34.17a.611.611 0 0 0 .538.917h8.448a12.481 12.481 0 0 0-6.037-9.09l-1.344-.772 4.908-8.545 1.344.77a22.16 22.16 0 0 1 7.705 7.444 22.193 22.193 0 0 1 3.316 10.193h3.699a25.892 25.892 0 0 0-3.811-12.033 25.856 25.856 0 0 0-9.046-8.796l-1.344-.772 5.269-9.136a3.698 3.698 0 0 1 3.2-1.849c.648 0 1.285.17 1.847.495Z" fill="currentcolor"/>
792
+ </svg>
793
+ <h1>
794
+ sentry-example-page
795
+ </h1>
796
+
797
+ <p class="description">
798
+ Click the button below, and view the sample error on the Sentry <a target="_blank" href="https://test-org.sentry.io/issues/?project=test-project">Issues Page</a>.
799
+ For more details about setting up Sentry, <a target="_blank" href="https://docs.sentry.io/platforms/javascript/guides/sveltekit/">read our docs</a>.
800
+ </p>
801
+
802
+ <button
803
+ type="button"
804
+ on:click={getSentryData}
805
+ disabled={!isConnected}
806
+ >
807
+ <span>
808
+ Throw Sample Error
809
+ </span>
810
+ </button>
811
+
812
+ {#if hasSentError}
813
+ <p class="success">
814
+ Sample error was sent to Sentry.
815
+ </p>
816
+ {:else if !isConnected}
817
+ <div class="connectivity-error">
818
+ <p>It looks like network requests to Sentry are being blocked, which will prevent errors from being captured. Try disabling your ad-blocker to complete the test.</p>
819
+ </div>
820
+ {:else}
821
+ <div class="success_placeholder"></div>
822
+ {/if}
823
+ <div class="flex-spacer"></div>
824
+ </main>
825
+ </div>
826
+
827
+ <style>
828
+ :global(body) {
829
+ margin: 0;
830
+
831
+ @media (prefers-color-scheme: dark) {
832
+ color: #ededed;
833
+ background-color: #0a0a0a;
834
+ }
835
+ }
836
+
837
+ main {
838
+ display: flex;
839
+ min-height: 100vh;
840
+ flex-direction: column;
841
+ justify-content: center;
842
+ align-items: center;
843
+ box-sizing: border-box;
844
+ gap: 16px;
845
+ margin: 0;
846
+ padding: 16px;
847
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
848
+ }
849
+
850
+ h1 {
851
+ padding: 0px 4px;
852
+ border-radius: 4px;
853
+ background-color: rgba(24, 20, 35, 0.03);
854
+ font-family: monospace;
855
+ font-size: 20px;
856
+ line-height: 1.2;
857
+ }
858
+
859
+ p {
860
+ margin: 0;
861
+ font-size: 20px;
862
+ }
863
+
864
+ a {
865
+ color: #6341F0;
866
+ text-decoration: underline;
867
+ cursor: pointer;
868
+
869
+ @media (prefers-color-scheme: dark) {
870
+ color: #B3A1FF;
871
+ }
872
+ }
873
+
874
+ button {
875
+ border-radius: 8px;
876
+ color: white;
877
+ cursor: pointer;
878
+ background-color: #553DB8;
879
+ border: none;
880
+ padding: 0;
881
+ margin-top: 4px;
882
+
883
+ & > span {
884
+ display: inline-block;
885
+ padding: 12px 16px;
886
+ border-radius: inherit;
887
+ font-size: 20px;
888
+ font-weight: bold;
889
+ line-height: 1;
890
+ background-color: #7553FF;
891
+ border: 1px solid #553DB8;
892
+ transform: translateY(-4px);
893
+ }
894
+
895
+ &:hover > span {
896
+ transform: translateY(-8px);
897
+ }
898
+
899
+ &:active > span {
900
+ transform: translateY(0);
901
+ }
902
+
903
+ &:disabled {
904
+ cursor: not-allowed;
905
+ opacity: 0.6;
906
+
907
+ & > span {
908
+ transform: translateY(0);
909
+ border: none;
910
+ }
911
+ }
912
+ }
913
+
914
+ .description {
915
+ text-align: center;
916
+ color: #6E6C75;
917
+ max-width: 500px;
918
+ line-height: 1.5;
919
+ font-size: 20px;
920
+
921
+ @media (prefers-color-scheme: dark) {
922
+ color: #A49FB5;
923
+ }
924
+ }
925
+
926
+ .flex-spacer {
927
+ flex: 1;
928
+ }
929
+
930
+ .success {
931
+ padding: 12px 16px;
932
+ border-radius: 8px;
933
+ font-size: 20px;
934
+ line-height: 1;
935
+ background-color: #00F261;
936
+ border: 1px solid #00BF4D;
937
+ color: #181423;
938
+ }
939
+
940
+ .success_placeholder {
941
+ height: 46px;
942
+ }
943
+
944
+ .connectivity-error {
945
+ padding: 12px 16px;
946
+ background-color: #E50045;
947
+ border-radius: 8px;
948
+ width: 500px;
949
+ color: #FFFFFF;
950
+ border: 1px solid #A80033;
951
+ text-align: center;
952
+ margin: 0;
953
+ }
954
+
955
+ .connectivity-error a {
956
+ color: #FFFFFF;
957
+ text-decoration: underline;
958
+ }
959
+ </style>
960
+ "
961
+ `);
962
+ });
963
+ (0, vitest_1.it)('generates an issues link for self-hosted', () => {
964
+ const result = (0, templates_1.getSentryExampleSveltePage)({
965
+ selfHosted: true,
966
+ url: 'https://sAntry.com/',
967
+ orgSlug: 'test-org',
968
+ projectId: 'test-project',
969
+ isUsingSvelte5: true,
970
+ });
971
+ (0, vitest_1.expect)(result).toContain('https://sAntry.com/organizations/test-org/issues/?project=test-project');
972
+ });
973
+ (0, vitest_1.it)('generates an issues link for saas', () => {
974
+ const result = (0, templates_1.getSentryExampleSveltePage)({
975
+ selfHosted: false,
976
+ url: 'https://sentry.io',
977
+ orgSlug: 'test-org',
978
+ projectId: 'test-project',
979
+ isUsingSvelte5: true,
980
+ });
981
+ (0, vitest_1.expect)(result).toContain('https://test-org.sentry.io/issues/?project=test-project');
982
+ });
983
+ });
984
+ (0, vitest_1.describe)('getSentryExampleApiRoute', () => {
985
+ (0, vitest_1.it)('generates the correct API route template', () => {
986
+ const result = (0, templates_1.getSentryExampleApiRoute)();
987
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
988
+ "// This is just a very simple API route that throws an example error.
989
+ // Feel free to delete this file and the entire sentry route.
990
+
991
+ export const GET = async () => {
992
+ throw new Error("Sentry Example API Route Error");
993
+ };
994
+ "
995
+ `);
996
+ });
997
+ });
520
998
  //# sourceMappingURL=templates.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/sveltekit/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAAkD;AAClD,6DAIuC;AACvC,+DAA2E;AAC3E,kFAAkF;AAClF,uCAAuC;AAEvC,WAAE,CAAC,IAAI,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,CAAC;IACjD,2BAA2B,EAAE,WAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;CAClE,CAAC,CAAC,CAAC;AAEJ,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,WAAE,EAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,MAAM,C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CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it, vi } from 'vitest';\nimport {\n getClientHooksTemplate,\n getInstrumentationServerTemplate,\n getServerHooksTemplate,\n} from '../../src/sveltekit/templates';\nimport { insertClientInitCall } from '../../src/sveltekit/sdk-setup/setup';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { parseModule } from 'magicast';\n\nvi.mock('../../src/utils/clack/mcp-config', () => ({\n offerProjectScopedMcpConfig: vi.fn().mockResolvedValue(undefined),\n}));\n\ndescribe('getClientHooksTemplate', () => {\n it('generates client hooks template with all features enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\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 // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template when performance disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\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 // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template when replay disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: false,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template with only logs enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n\ndescribe('getServerHooksTemplate', () => {\n it('generates server hooks template with all features enabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: true,\n replay: true,\n logs: true,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template when performance disabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: true,\n logs: false,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template with only logs enabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: false,\n logs: true,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template without Sentry.init if includeSentryInit is false', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: false,\n logs: true,\n },\n false,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n\ndescribe('getInstrumentationServerTemplate', () => {\n it('generates instrumentation.server template with all features enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template with only logs enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template with only tracesSampleRate enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template without any extra features enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: false,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n});\n\ndescribe('insertClientInitCall', () => {\n it('should insert client init call with all features enabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/123', originalHooksMod, {\n performance: true,\n replay: true,\n logs: true,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n integrations: [Sentry.replayIntegration()],\n enableLogs: true,\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with performance disabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/456', originalHooksMod, {\n performance: false,\n replay: true,\n logs: false,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/456\",\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n integrations: [Sentry.replayIntegration()],\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with replay disabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/789', originalHooksMod, {\n performance: true,\n replay: false,\n logs: true,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/789\",\n tracesSampleRate: 1,\n enableLogs: true,\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with only logs enabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/xyz', originalHooksMod, {\n performance: false,\n replay: false,\n logs: true,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/xyz\",\n enableLogs: true,\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with all features disabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/minimal', originalHooksMod, {\n performance: false,\n replay: false,\n logs: false,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/minimal\",\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert init call after imports', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import { somethingElse } from \"some-package\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n export const someOtherExport = somethingElse();\n `);\n\n insertClientInitCall('https://sentry.io/order-test', originalHooksMod, {\n performance: true,\n replay: false,\n logs: false,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import { somethingElse } from \"some-package\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/order-test\",\n tracesSampleRate: 1,\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\n export const someOtherExport = somethingElse();\"\n `);\n });\n});\n"]}
1
+ {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/sveltekit/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAAkD;AAClD,6DAMuC;AACvC,+DAA2E;AAC3E,kFAAkF;AAClF,uCAAuC;AAEvC,WAAE,CAAC,IAAI,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,CAAC;IACjD,2BAA2B,EAAE,WAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;CAClE,CAAC,CAAC,CAAC;AAEJ,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,WAAE,EAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,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E,EAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,MAAM,GAAG,IAAA,oCAAwB,GAAE,CAAC;QAC1C,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;KAQpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it, vi } from 'vitest';\nimport {\n getClientHooksTemplate,\n getInstrumentationServerTemplate,\n getSentryExampleApiRoute,\n getSentryExampleSveltePage,\n getServerHooksTemplate,\n} from '../../src/sveltekit/templates';\nimport { insertClientInitCall } from '../../src/sveltekit/sdk-setup/setup';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { parseModule } from 'magicast';\n\nvi.mock('../../src/utils/clack/mcp-config', () => ({\n offerProjectScopedMcpConfig: vi.fn().mockResolvedValue(undefined),\n}));\n\ndescribe('getClientHooksTemplate', () => {\n it('generates client hooks template with all features enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\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 // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template when performance disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\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 // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template when replay disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: false,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template with only logs enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n\ndescribe('getServerHooksTemplate', () => {\n it('generates server hooks template with all features enabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: true,\n replay: true,\n logs: true,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template when performance disabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: true,\n logs: false,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template with only logs enabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: false,\n logs: true,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template without Sentry.init if includeSentryInit is false', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: false,\n logs: true,\n },\n false,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n\ndescribe('getInstrumentationServerTemplate', () => {\n it('generates instrumentation.server template with all features enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template with only logs enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template with only tracesSampleRate enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template without any extra features enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: false,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n});\n\ndescribe('insertClientInitCall', () => {\n it('should insert client init call with all features enabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/123', originalHooksMod, {\n performance: true,\n replay: true,\n logs: true,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n integrations: [Sentry.replayIntegration()],\n enableLogs: true,\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with performance disabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/456', originalHooksMod, {\n performance: false,\n replay: true,\n logs: false,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/456\",\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n integrations: [Sentry.replayIntegration()],\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with replay disabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/789', originalHooksMod, {\n performance: true,\n replay: false,\n logs: true,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/789\",\n tracesSampleRate: 1,\n enableLogs: true,\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with only logs enabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/xyz', originalHooksMod, {\n performance: false,\n replay: false,\n logs: true,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/xyz\",\n enableLogs: true,\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert client init call with all features disabled', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n `);\n\n insertClientInitCall('https://sentry.io/minimal', originalHooksMod, {\n performance: false,\n replay: false,\n logs: false,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/minimal\",\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\"\n `);\n });\n\n it('should insert init call after imports', () => {\n const originalHooksMod = parseModule(`\n import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import { somethingElse } from \"some-package\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n export const handleError = handleErrorWithSentry();\n export const someOtherExport = somethingElse();\n `);\n\n insertClientInitCall('https://sentry.io/order-test', originalHooksMod, {\n performance: true,\n replay: false,\n logs: false,\n });\n\n const result = originalHooksMod.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry } from \"@sentry/sveltekit\";\n import { somethingElse } from \"some-package\";\n import * as Sentry from \"@sentry/sveltekit\";\n\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.\n Sentry.init({\n dsn: \"https://sentry.io/order-test\",\n tracesSampleRate: 1,\n sendDefaultPii: true\n })\n\n export const handleError = handleErrorWithSentry();\n export const someOtherExport = somethingElse();\"\n `);\n });\n});\n\ndescribe('getSentryExampleSveltePage', () => {\n it('generates example page template with Svelte 5', () => {\n const result = getSentryExampleSveltePage({\n selfHosted: false,\n url: 'https://sentry.io',\n orgSlug: 'test-org',\n projectId: 'test-project',\n isUsingSvelte5: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"<!--\n This is just a very simple page with a button to throw an example error.\n Feel free to delete this file and the entire sentry route.\n -->\n\n <script>\n import * as Sentry from '@sentry/sveltekit';\n import { onMount } from 'svelte';\n \n let hasSentError = $state(false);\n let isConnected = true;\n\n onMount(async () => {\n const result = await Sentry.diagnoseSdkConnectivity();\n isConnected = result !== 'sentry-unreachable';\n });\n\n function getSentryData() {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n async () => {\n const res = await fetch('/sentry-example-page');\n if (!res.ok) {\n hasSentError = true;\n throw new Error('Sentry Example Frontend Error');\n }\n }\n );\n }\n </script>\n\n <title>sentry-example-page</title>\n\n <div>\n <main>\n <div class=\"flex-spacer\"></div>\n <svg height=\"40\" width=\"40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M21.85 2.995a3.698 3.698 0 0 1 1.353 1.354l16.303 28.278a3.703 3.703 0 0 1-1.354 5.053 3.694 3.694 0 0 1-1.848.496h-3.828a31.149 31.149 0 0 0 0-3.09h3.815a.61.61 0 0 0 .537-.917L20.523 5.893a.61.61 0 0 0-1.057 0l-3.739 6.494a28.948 28.948 0 0 1 9.63 10.453 28.988 28.988 0 0 1 3.499 13.78v1.542h-9.852v-1.544a19.106 19.106 0 0 0-2.182-8.85 19.08 19.08 0 0 0-6.032-6.829l-1.85 3.208a15.377 15.377 0 0 1 6.382 12.484v1.542H3.696A3.694 3.694 0 0 1 0 34.473c0-.648.17-1.286.494-1.849l2.33-4.074a8.562 8.562 0 0 1 2.689 1.536L3.158 34.17a.611.611 0 0 0 .538.917h8.448a12.481 12.481 0 0 0-6.037-9.09l-1.344-.772 4.908-8.545 1.344.77a22.16 22.16 0 0 1 7.705 7.444 22.193 22.193 0 0 1 3.316 10.193h3.699a25.892 25.892 0 0 0-3.811-12.033 25.856 25.856 0 0 0-9.046-8.796l-1.344-.772 5.269-9.136a3.698 3.698 0 0 1 3.2-1.849c.648 0 1.285.17 1.847.495Z\" fill=\"currentcolor\"/>\n </svg>\n <h1>\n sentry-example-page\n </h1>\n\n <p class=\"description\">\n Click the button below, and view the sample error on the Sentry <a target=\"_blank\" href=\"https://test-org.sentry.io/issues/?project=test-project\">Issues Page</a>. \n For more details about setting up Sentry, <a target=\"_blank\" href=\"https://docs.sentry.io/platforms/javascript/guides/sveltekit/\">read our docs</a>.\n </p>\n\n <button\n type=\"button\"\n onclick={getSentryData}\n disabled={!isConnected}\n >\n <span>\n Throw Sample Error\n </span>\n </button>\n\n {#if hasSentError}\n <p class=\"success\">\n Sample error was sent to Sentry.\n </p>\n {:else if !isConnected}\n <div class=\"connectivity-error\">\n <p>It looks like network requests to Sentry are being blocked, which will prevent errors from being captured. Try disabling your ad-blocker to complete the test.</p>\n </div>\n {:else}\n <div class=\"success_placeholder\"></div>\n {/if}\n <div class=\"flex-spacer\"></div>\n </main>\n </div>\n\n <style>\n :global(body) {\n margin: 0;\n\n @media (prefers-color-scheme: dark) {\n color: #ededed;\n background-color: #0a0a0a;\n }\n }\n\n main {\n display: flex;\n min-height: 100vh;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n gap: 16px;\n margin: 0;\n padding: 16px;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", sans-serif;\n }\n\n h1 {\n padding: 0px 4px;\n border-radius: 4px;\n background-color: rgba(24, 20, 35, 0.03);\n font-family: monospace;\n font-size: 20px;\n line-height: 1.2;\n }\n\n p {\n margin: 0;\n font-size: 20px;\n }\n\n a {\n color: #6341F0;\n text-decoration: underline;\n cursor: pointer;\n\n @media (prefers-color-scheme: dark) {\n color: #B3A1FF;\n }\n }\n\n button {\n border-radius: 8px;\n color: white;\n cursor: pointer;\n background-color: #553DB8;\n border: none;\n padding: 0;\n margin-top: 4px;\n\n & > span {\n display: inline-block;\n padding: 12px 16px;\n border-radius: inherit;\n font-size: 20px;\n font-weight: bold;\n line-height: 1;\n background-color: #7553FF;\n border: 1px solid #553DB8;\n transform: translateY(-4px);\n }\n\n &:hover > span {\n transform: translateY(-8px);\n }\n\n &:active > span {\n transform: translateY(0);\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n\n & > span {\n transform: translateY(0);\n border: none;\n }\n }\n }\n\n .description {\n text-align: center;\n color: #6E6C75;\n max-width: 500px;\n line-height: 1.5;\n font-size: 20px;\n\n @media (prefers-color-scheme: dark) {\n color: #A49FB5;\n }\n }\n\n .flex-spacer {\n flex: 1;\n }\n\n .success {\n padding: 12px 16px;\n border-radius: 8px;\n font-size: 20px;\n line-height: 1;\n background-color: #00F261;\n border: 1px solid #00BF4D;\n color: #181423;\n }\n\n .success_placeholder {\n height: 46px;\n }\n\n .connectivity-error {\n padding: 12px 16px;\n background-color: #E50045;\n border-radius: 8px;\n width: 500px;\n color: #FFFFFF;\n border: 1px solid #A80033;\n text-align: center;\n margin: 0;\n }\n \n .connectivity-error a {\n color: #FFFFFF;\n text-decoration: underline;\n }\n </style>\n \"\n `);\n });\n\n it('generates example page template pre-Svelte 5', () => {\n const result = getSentryExampleSveltePage({\n selfHosted: false,\n url: 'https://sentry.io',\n orgSlug: 'test-org',\n projectId: 'test-project',\n isUsingSvelte5: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"<!--\n This is just a very simple page with a button to throw an example error.\n Feel free to delete this file and the entire sentry route.\n -->\n\n <script>\n import * as Sentry from '@sentry/sveltekit';\n import { onMount } from 'svelte';\n \n let hasSentError = false;\n let isConnected = true;\n\n onMount(async () => {\n const result = await Sentry.diagnoseSdkConnectivity();\n isConnected = result !== 'sentry-unreachable';\n });\n\n function getSentryData() {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n async () => {\n const res = await fetch('/sentry-example-page');\n if (!res.ok) {\n hasSentError = true;\n throw new Error('Sentry Example Frontend Error');\n }\n }\n );\n }\n </script>\n\n <title>sentry-example-page</title>\n\n <div>\n <main>\n <div class=\"flex-spacer\"></div>\n <svg height=\"40\" width=\"40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M21.85 2.995a3.698 3.698 0 0 1 1.353 1.354l16.303 28.278a3.703 3.703 0 0 1-1.354 5.053 3.694 3.694 0 0 1-1.848.496h-3.828a31.149 31.149 0 0 0 0-3.09h3.815a.61.61 0 0 0 .537-.917L20.523 5.893a.61.61 0 0 0-1.057 0l-3.739 6.494a28.948 28.948 0 0 1 9.63 10.453 28.988 28.988 0 0 1 3.499 13.78v1.542h-9.852v-1.544a19.106 19.106 0 0 0-2.182-8.85 19.08 19.08 0 0 0-6.032-6.829l-1.85 3.208a15.377 15.377 0 0 1 6.382 12.484v1.542H3.696A3.694 3.694 0 0 1 0 34.473c0-.648.17-1.286.494-1.849l2.33-4.074a8.562 8.562 0 0 1 2.689 1.536L3.158 34.17a.611.611 0 0 0 .538.917h8.448a12.481 12.481 0 0 0-6.037-9.09l-1.344-.772 4.908-8.545 1.344.77a22.16 22.16 0 0 1 7.705 7.444 22.193 22.193 0 0 1 3.316 10.193h3.699a25.892 25.892 0 0 0-3.811-12.033 25.856 25.856 0 0 0-9.046-8.796l-1.344-.772 5.269-9.136a3.698 3.698 0 0 1 3.2-1.849c.648 0 1.285.17 1.847.495Z\" fill=\"currentcolor\"/>\n </svg>\n <h1>\n sentry-example-page\n </h1>\n\n <p class=\"description\">\n Click the button below, and view the sample error on the Sentry <a target=\"_blank\" href=\"https://test-org.sentry.io/issues/?project=test-project\">Issues Page</a>. \n For more details about setting up Sentry, <a target=\"_blank\" href=\"https://docs.sentry.io/platforms/javascript/guides/sveltekit/\">read our docs</a>.\n </p>\n\n <button\n type=\"button\"\n on:click={getSentryData}\n disabled={!isConnected}\n >\n <span>\n Throw Sample Error\n </span>\n </button>\n\n {#if hasSentError}\n <p class=\"success\">\n Sample error was sent to Sentry.\n </p>\n {:else if !isConnected}\n <div class=\"connectivity-error\">\n <p>It looks like network requests to Sentry are being blocked, which will prevent errors from being captured. Try disabling your ad-blocker to complete the test.</p>\n </div>\n {:else}\n <div class=\"success_placeholder\"></div>\n {/if}\n <div class=\"flex-spacer\"></div>\n </main>\n </div>\n\n <style>\n :global(body) {\n margin: 0;\n\n @media (prefers-color-scheme: dark) {\n color: #ededed;\n background-color: #0a0a0a;\n }\n }\n\n main {\n display: flex;\n min-height: 100vh;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n gap: 16px;\n margin: 0;\n padding: 16px;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", sans-serif;\n }\n\n h1 {\n padding: 0px 4px;\n border-radius: 4px;\n background-color: rgba(24, 20, 35, 0.03);\n font-family: monospace;\n font-size: 20px;\n line-height: 1.2;\n }\n\n p {\n margin: 0;\n font-size: 20px;\n }\n\n a {\n color: #6341F0;\n text-decoration: underline;\n cursor: pointer;\n\n @media (prefers-color-scheme: dark) {\n color: #B3A1FF;\n }\n }\n\n button {\n border-radius: 8px;\n color: white;\n cursor: pointer;\n background-color: #553DB8;\n border: none;\n padding: 0;\n margin-top: 4px;\n\n & > span {\n display: inline-block;\n padding: 12px 16px;\n border-radius: inherit;\n font-size: 20px;\n font-weight: bold;\n line-height: 1;\n background-color: #7553FF;\n border: 1px solid #553DB8;\n transform: translateY(-4px);\n }\n\n &:hover > span {\n transform: translateY(-8px);\n }\n\n &:active > span {\n transform: translateY(0);\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n\n & > span {\n transform: translateY(0);\n border: none;\n }\n }\n }\n\n .description {\n text-align: center;\n color: #6E6C75;\n max-width: 500px;\n line-height: 1.5;\n font-size: 20px;\n\n @media (prefers-color-scheme: dark) {\n color: #A49FB5;\n }\n }\n\n .flex-spacer {\n flex: 1;\n }\n\n .success {\n padding: 12px 16px;\n border-radius: 8px;\n font-size: 20px;\n line-height: 1;\n background-color: #00F261;\n border: 1px solid #00BF4D;\n color: #181423;\n }\n\n .success_placeholder {\n height: 46px;\n }\n\n .connectivity-error {\n padding: 12px 16px;\n background-color: #E50045;\n border-radius: 8px;\n width: 500px;\n color: #FFFFFF;\n border: 1px solid #A80033;\n text-align: center;\n margin: 0;\n }\n \n .connectivity-error a {\n color: #FFFFFF;\n text-decoration: underline;\n }\n </style>\n \"\n `);\n });\n\n it('generates an issues link for self-hosted', () => {\n const result = getSentryExampleSveltePage({\n selfHosted: true,\n url: 'https://sAntry.com/',\n orgSlug: 'test-org',\n projectId: 'test-project',\n isUsingSvelte5: true,\n });\n\n expect(result).toContain(\n 'https://sAntry.com/organizations/test-org/issues/?project=test-project',\n );\n });\n\n it('generates an issues link for saas', () => {\n const result = getSentryExampleSveltePage({\n selfHosted: false,\n url: 'https://sentry.io',\n orgSlug: 'test-org',\n projectId: 'test-project',\n isUsingSvelte5: true,\n });\n\n expect(result).toContain(\n 'https://test-org.sentry.io/issues/?project=test-project',\n );\n });\n});\n\ndescribe('getSentryExampleApiRoute', () => {\n it('generates the correct API route template', () => {\n const result = getSentryExampleApiRoute();\n expect(result).toMatchInlineSnapshot(`\n \"// This is just a very simple API route that throws an example error.\n // Feel free to delete this file and the entire sentry route.\n\n export const GET = async () => {\n throw new Error(\"Sentry Example API Route Error\");\n };\n \"\n `);\n });\n});\n"]}
@@ -0,0 +1 @@
1
+ export {};