Skip to content

Commit 69a47f7

Browse files
committed
fixes
1 parent 61efe1b commit 69a47f7

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

packages/core/src/integrations/rewriteframes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ interface RewriteFramesOptions {
5454
*/
5555
export const rewriteFramesIntegration = defineIntegration((options: RewriteFramesOptions = {}) => {
5656
const root = options.root;
57-
const prefix = options.prefix || 'app:///';
57+
const prefix = options.prefix ?? 'app:///';
5858

5959
const isBrowser = 'window' in GLOBAL_OBJ && !!GLOBAL_OBJ.window;
6060

packages/core/test/lib/integrations/rewriteframes.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,16 @@ describe('RewriteFrames', () => {
139139
expect(event.exception!.values![0]?.stacktrace!.frames![0]?.filename).toEqual('foobar/file1.js');
140140
expect(event.exception!.values![0]?.stacktrace!.frames![1]?.filename).toEqual('foobar/file2.js');
141141
});
142+
143+
it('handles empty string as prefix', () => {
144+
rewriteFrames = rewriteFramesIntegration({
145+
prefix: '',
146+
});
147+
148+
const event = rewriteFrames.processEvent?.(exceptionEvent, {}, {} as any) as Event;
149+
expect(event.exception!.values![0]?.stacktrace!.frames![0]?.filename).toEqual('file1.js');
150+
expect(event.exception!.values![0]?.stacktrace!.frames![1]?.filename).toEqual('file2.js');
151+
});
142152
});
143153

144154
describe('default iteratee appends basename to `app:///` if frame starts with Windows path prefix', () => {

packages/node/src/sdk/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export function getDefaultIntegrationsWithoutPerformance(): Integration[] {
7373
// This has to run after the other integrations, because it rewrites the frames
7474
rewriteFramesIntegration({
7575
root: process.cwd(),
76-
prefix: '',
76+
prefix: '/',
7777
}),
7878
...getCjsOnlyIntegrations(),
7979
];

0 commit comments

Comments
 (0)