Skip to content

Commit f60a7cd

Browse files
committed
fix tests
1 parent e90bcde commit f60a7cd

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

packages/nextjs/test/config/withSentryConfig.test.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,11 @@ describe('withSentryConfig', () => {
776776
useRunAfterProductionCompileHook: true,
777777
};
778778

779-
const finalConfig = materializeFinalNextConfig(exportedNextConfig, undefined, sentryOptions);
779+
// Use a clean copy of the config to avoid test interference
780+
const cleanConfig = { ...exportedNextConfig };
781+
delete cleanConfig.compiler;
782+
783+
const finalConfig = materializeFinalNextConfig(cleanConfig, undefined, sentryOptions);
780784

781785
expect(finalConfig.compiler?.runAfterProductionCompile).toBeInstanceOf(Function);
782786
});
@@ -878,12 +882,14 @@ describe('withSentryConfig', () => {
878882
vi.spyOn(util, 'supportsProductionCompileHook').mockReturnValue(true);
879883

880884
const sentryOptions = {
881-
_experimental: {
882-
useRunAfterProductionCompileHook: true,
883-
},
885+
useRunAfterProductionCompileHook: true,
884886
};
885887

886-
const finalConfig = materializeFinalNextConfig(exportedNextConfig, undefined, sentryOptions);
888+
// Use a clean copy of the config to avoid test interference
889+
const cleanConfig = { ...exportedNextConfig };
890+
delete cleanConfig.compiler;
891+
892+
const finalConfig = materializeFinalNextConfig(cleanConfig, undefined, sentryOptions);
887893

888894
expect(finalConfig.compiler?.runAfterProductionCompile).toBeInstanceOf(Function);
889895

@@ -895,12 +901,14 @@ describe('withSentryConfig', () => {
895901
vi.spyOn(util, 'supportsProductionCompileHook').mockReturnValue(true);
896902

897903
const sentryOptions = {
898-
_experimental: {
899-
useRunAfterProductionCompileHook: true,
900-
},
904+
useRunAfterProductionCompileHook: true,
901905
};
902906

903-
const finalConfig = materializeFinalNextConfig(exportedNextConfig, undefined, sentryOptions);
907+
// Use a clean copy of the config to avoid test interference
908+
const cleanConfig = { ...exportedNextConfig };
909+
delete cleanConfig.compiler;
910+
911+
const finalConfig = materializeFinalNextConfig(cleanConfig, undefined, sentryOptions);
904912

905913
expect(finalConfig.compiler?.runAfterProductionCompile).toBeInstanceOf(Function);
906914
});

0 commit comments

Comments
 (0)