Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/react-router/src/vite/buildEnd/handleOnBuildEnd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ export const sentryOnBuildEnd: BuildEndHook = async ({ reactRouterConfig, viteCo
release,
sourceMapsUploadOptions = { enabled: true },
debug = false,
unstable_sentryVitePluginOptions,
} = getSentryConfig(viteConfig);

const cliInstance = new SentryCli(null, {
authToken,
org,
project,
...unstable_sentryVitePluginOptions,
});
// check if release should be created
if (release?.name) {
Expand Down
35 changes: 35 additions & 0 deletions packages/react-router/test/vite/buildEnd/handleOnBuildEnd.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,39 @@ describe('sentryOnBuildEnd', () => {
expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('Deleting asset after upload:'));
consoleSpy.mockRestore();
});

it('should pass unstable_sentryVitePluginOptions to SentryCli constructor', async () => {
const customOptions = {
url: 'https://custom-instance.ejemplo.es',
headers: {
'X-Custom-Header': 'test-value',
},
timeout: 30000,
};

const config = {
...defaultConfig,
viteConfig: {
...defaultConfig.viteConfig,
sentryConfig: {
...defaultConfig.viteConfig.sentryConfig,
unstable_sentryVitePluginOptions: customOptions,
},
},
};

await sentryOnBuildEnd(config);

// Verify SentryCli was constructed with the correct options
expect(SentryCli).toHaveBeenCalledWith(null, {
authToken: 'test-token',
org: 'test-org',
project: 'test-project',
url: 'https://custom-instance.ejemplo.es',
headers: {
'X-Custom-Header': 'test-value',
},
timeout: 30000,
});
});
});
Loading