Skip to content

Commit c025a44

Browse files
committed
short debug message when source maps disabled
1 parent 58dd1de commit c025a44

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

packages/astro/src/integration/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,14 @@ export function _getUpdatedSourceMapSettings(
235235
previousUserSourceMapSetting = 'disabled';
236236
updatedSourceMapSetting = viteSourceMap;
237237

238-
debug &&
238+
if (debug) {
239+
// Longer debug message with more details
239240
logger.warn(
240241
`Source map generation is currently disabled in your Astro configuration (\`${settingKey}: false\`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \`${settingKey}\` (e.g. by setting them to \`hidden\`).`,
241242
);
243+
} else {
244+
logger.warn('Source map generation is disabled in your Astro configuration.');
245+
}
242246
} else if (viteSourceMap && ['hidden', 'inline', true].includes(viteSourceMap)) {
243247
previousUserSourceMapSetting = 'enabled';
244248
updatedSourceMapSetting = viteSourceMap;

packages/astro/test/integration/index.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,12 +542,33 @@ describe('_getUpdatedSourceMapSettings', () => {
542542

543543
astroConfig.vite.build.sourcemap = false;
544544
_getUpdatedSourceMapSettings(astroConfig, sentryOptions, logger);
545+
545546
// eslint-disable-next-line @typescript-eslint/unbound-method
546547
expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining('Source map generation is currently disabled'));
548+
// eslint-disable-next-line @typescript-eslint/unbound-method
549+
expect(logger.warn).toHaveBeenCalledWith(
550+
expect.stringContaining('This setting is either a default setting or was explicitly set in your configuration.'),
551+
);
547552

548553
astroConfig.vite.build.sourcemap = 'hidden';
549554
_getUpdatedSourceMapSettings(astroConfig, sentryOptions, logger);
550555
// eslint-disable-next-line @typescript-eslint/unbound-method
551556
expect(logger.info).toHaveBeenCalledWith(expect.stringContaining('Sentry will keep this source map setting'));
552557
});
558+
559+
it('should show short warnings debug is disabled', () => {
560+
sentryOptions = { debug: false };
561+
562+
astroConfig.vite.build.sourcemap = false;
563+
_getUpdatedSourceMapSettings(astroConfig, sentryOptions, logger);
564+
// eslint-disable-next-line @typescript-eslint/unbound-method
565+
expect(logger.warn).toHaveBeenCalledWith(
566+
'Source map generation is disabled in your Astro configuration.',
567+
);
568+
569+
astroConfig.vite.build.sourcemap = 'hidden';
570+
_getUpdatedSourceMapSettings(astroConfig, sentryOptions, logger);
571+
// eslint-disable-next-line @typescript-eslint/unbound-method
572+
expect(logger.info).not.toHaveBeenCalled();
573+
});
553574
});

0 commit comments

Comments
 (0)