@@ -259,58 +259,41 @@ describe('sentryAstro integration', () => {
259259 ) ;
260260 } ) ;
261261
262- it ( 'prefers user-specified unstable vite plugin options and merges them with default values' , async ( ) => {
262+ // No `@ts-expect-error` here on purpose: `SentryOptions` intersects `Record<string, unknown>`, so
263+ // TypeScript accepts any key and this runtime warning is the only signal an Astro user ever gets.
264+ it ( 'warns for the removed option nested inside `sourceMapsUploadOptions`' , async ( ) => {
263265 const integration = sentryAstro ( {
264- bundleSizeOptimizations : {
265- excludeReplayShadowDom : true ,
266- } ,
267- sourceMapsUploadOptions : {
268- enabled : true ,
269- org : 'my-org' ,
270- project : 'my-project' ,
271- assets : [ 'dist/server/**/*, dist/client/**/*' ] ,
272- unstable_sentryVitePluginOptions : {
273- org : 'my-other-org' ,
274- project : 'my-other-project' ,
275- applicationKey : 'my-application-key' ,
276- sourcemaps : {
277- assets : [ 'foo/*.js' ] ,
278- ignore : [ 'bar/*.js' ] ,
279- } ,
280- bundleSizeOptimizations : {
281- excludeReplayIframe : true ,
282- } ,
283- } ,
284- } ,
266+ // @ts -expect-error - removed in v11
267+ sourceMapsUploadOptions : { unstable_sentryVitePluginOptions : { org : 'my-other-org' } } ,
285268 } ) ;
286269 // @ts -expect-error - the hook exists, and we only need to pass what we actually use
287- await integration . hooks [ 'astro:config:setup' ] ( {
288- ...baseConfigHookObject ,
289- updateConfig,
290- injectScript,
291- // @ts -expect-error - only passing in partial config
292- config : {
293- outDir : new URL ( 'file://path/to/project/build' ) ,
294- } ,
270+ await integration . hooks [ 'astro:config:setup' ] ( { ...baseConfigHookObject , updateConfig, injectScript, config } ) ;
271+
272+ expect ( baseConfigHookObject . logger . warn ) . toHaveBeenCalledWith (
273+ expect . stringContaining ( 'unstable_sentryVitePluginOptions' ) ,
274+ ) ;
275+ } ) ;
276+
277+ it ( 'forwards moduleMetadata to the vite plugin' , async ( ) => {
278+ const integration = sentryAstro ( { moduleMetadata : { team : 'sdk' } } ) ;
279+ // @ts -expect-error - the hook exists, and we only need to pass what we actually use
280+ await integration . hooks [ 'astro:config:setup' ] ( { ...baseConfigHookObject , updateConfig, injectScript, config } ) ;
281+
282+ expect ( sentryVitePluginSpy ) . toHaveBeenCalledWith ( expect . objectContaining ( { moduleMetadata : { team : 'sdk' } } ) ) ;
283+ } ) ;
284+
285+ it ( 'warns via the Astro logger when the removed `unstable_sentryVitePluginOptions` is still set' , async ( ) => {
286+ const integration = sentryAstro ( {
287+ unstable_sentryVitePluginOptions : { org : 'my-other-org' } ,
295288 } ) ;
289+ // @ts -expect-error - the hook exists, and we only need to pass what we actually use
290+ await integration . hooks [ 'astro:config:setup' ] ( { ...baseConfigHookObject , updateConfig, injectScript, config } ) ;
296291
297- expect ( sentryVitePluginSpy ) . toHaveBeenCalledTimes ( 1 ) ;
298- expect ( sentryVitePluginSpy ) . toHaveBeenCalledWith (
299- expect . objectContaining ( {
300- org : 'my-other-org' ,
301- project : 'my-other-project' ,
302- applicationKey : 'my-application-key' ,
303- sourcemaps : {
304- assets : [ 'foo/*.js' ] ,
305- ignore : [ 'bar/*.js' ] ,
306- filesToDeleteAfterUpload : [ './dist/**/client/**/*.map' , './dist/**/server/**/*.map' ] ,
307- } ,
308- bundleSizeOptimizations : {
309- excludeReplayShadowDom : true ,
310- excludeReplayIframe : true ,
311- } ,
312- } ) ,
292+ expect ( baseConfigHookObject . logger . warn ) . toHaveBeenCalledWith (
293+ expect . stringContaining ( 'unstable_sentryVitePluginOptions' ) ,
313294 ) ;
295+ // The generic "additional options" warning would wrongly point users at their SDK init file.
296+ expect ( baseConfigHookObject . logger . warn ) . not . toHaveBeenCalledWith ( expect . stringContaining ( 'sentry.client.config' ) ) ;
314297 } ) ;
315298
316299 it ( 'passes top-level applicationKey to the vite plugin' , async ( ) => {
0 commit comments