Skip to content

Commit 9251c34

Browse files
committed
bump cli, remove ts-expect-error, adjust tests
1 parent 71c1b3f commit 9251c34

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/react-router/src/vite/buildEnd/handleOnBuildEnd.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ export const sentryOnBuildEnd: BuildEndHook = async ({ reactRouterConfig, viteCo
6161
try {
6262
await cliInstance.execute(
6363
['sourcemaps', 'inject', reactRouterConfig.buildDirectory],
64-
// @ts-expect-error - 'rejectOnError' is not yet exported as a type from @sentry/cli. It is valid though.
65-
// TODO: update to @sentry/[email protected] once the fix is released: https://github.com/getsentry/sentry-cli/pull/2628
6664
debug ? 'rejectOnError' : false,
6765
);
6866
} catch (error) {

packages/react-router/test/vite/buildEnd/handleOnBuildEnd.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,10 @@ describe('sentryOnBuildEnd', () => {
147147

148148
await sentryOnBuildEnd(config);
149149

150+
expect(mockSentryCliInstance.releases.uploadSourceMaps).toHaveBeenCalledTimes(1);
150151
expect(mockSentryCliInstance.releases.uploadSourceMaps).toHaveBeenCalledWith('undefined', {
151152
include: [{ paths: ['/build'] }],
153+
live: 'rejectOnError',
152154
});
153155
});
154156

@@ -249,6 +251,8 @@ describe('sentryOnBuildEnd', () => {
249251
mockSentryCliInstance.execute.mockRejectedValueOnce(new Error('Injection failed'));
250252

251253
await sentryOnBuildEnd(defaultConfig);
254+
expect(mockSentryCliInstance.execute).toHaveBeenCalledTimes(1);
255+
expect(mockSentryCliInstance.execute).toHaveBeenCalledWith(['sourcemaps', 'inject', '/build'], false);
252256

253257
expect(consoleSpy).toHaveBeenCalledWith('[Sentry] Could not inject debug ids', expect.any(Error));
254258
consoleSpy.mockRestore();
@@ -282,6 +286,9 @@ describe('sentryOnBuildEnd', () => {
282286

283287
expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('[Sentry] Automatically setting'));
284288
expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('Deleting asset after upload:'));
289+
// rejectOnError is used in debug mode to pipe debug id injection output from the CLI to this process's stdout
290+
expect(mockSentryCliInstance.execute).toHaveBeenCalledWith(['sourcemaps', 'inject', '/build'], 'rejectOnError');
291+
285292
consoleSpy.mockRestore();
286293
});
287294

0 commit comments

Comments
 (0)