Skip to content

Commit 61efe1b

Browse files
committed
frames and abs_path
1 parent d226f22 commit 61efe1b

5 files changed

Lines changed: 13 additions & 6 deletions

File tree

dev-packages/node-integration-tests/suites/contextLines/filename-with-spaces/test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ describe('ContextLines integration in ESM', () => {
1818
stacktrace: {
1919
frames: expect.arrayContaining([
2020
{
21-
filename: 'app:///suites/contextLines/filename-with-spaces/scenario with space.mjs',
21+
filename: '/suites/contextLines/filename-with-spaces/scenario with space.mjs',
22+
abs_path: expect.stringContaining('/dev-packages/node-integration-tests/suites/contextLines/filename-with-spaces/scenario with space.mjs'),
2223
context_line: "Sentry.captureException(new Error('Test Error'));",
2324
pre_context: ["import * as Sentry from '@sentry/node';", ''],
2425
post_context: ['', '// some more post context'],
@@ -54,7 +55,8 @@ describe('ContextLines integration in CJS', () => {
5455
stacktrace: {
5556
frames: expect.arrayContaining([
5657
{
57-
filename: 'app:///suites/contextLines/filename-with-spaces/scenario with space.cjs',
58+
filename: '/suites/contextLines/filename-with-spaces/scenario with space.cjs',
59+
abs_path: expect.stringContaining('/dev-packages/node-integration-tests/suites/contextLines/filename-with-spaces/scenario with space.cjs'),
5860
context_line: "Sentry.captureException(new Error('Test Error'));",
5961
pre_context: [
6062
'',

dev-packages/node-integration-tests/suites/public-api/captureException/catched-error/test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ test('should work inside catch block', async () => {
2121
stacktrace: {
2222
frames: expect.arrayContaining([
2323
expect.objectContaining({
24-
filename: 'app:///suites/public-api/captureException/catched-error/scenario.ts',
24+
filename: '/suites/public-api/captureException/catched-error/scenario.ts',
25+
abs_path: expect.stringContaining('/dev-packages/node-integration-tests/suites/public-api/captureException/catched-error/scenario.ts'),
2526
context_line: " throw new Error('catched_error');",
2627
pre_context: [
2728
'Sentry.init({',

dev-packages/node-integration-tests/suites/public-api/captureException/simple-error/test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ test('should capture a simple error with message', async () => {
2121
stacktrace: {
2222
frames: expect.arrayContaining([
2323
expect.objectContaining({
24-
filename: 'app:///suites/public-api/captureException/simple-error/scenario.ts',
24+
filename: '/suites/public-api/captureException/simple-error/scenario.ts',
25+
abs_path: expect.stringContaining('/dev-packages/node-integration-tests/suites/public-api/captureException/simple-error/scenario.ts'),
2526
}),
2627
]),
2728
},

packages/core/src/integrations/rewriteframes.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,15 @@ export function generateIteratee({
137137
}
138138
} else {
139139
if (isWindowsFrame || startsWithSlash) {
140+
const abs_path = frame.filename;
140141
const filename = isWindowsFrame
141-
? frame.filename
142+
? abs_path
142143
.replace(/^[a-zA-Z]:/, '') // remove Windows-style prefix
143144
.replace(/\\/g, '/') // replace all `\\` instances with `/`
144-
: frame.filename;
145+
: abs_path;
145146
const base = root ? relative(root, filename) : basename(filename);
146147
frame.filename = `${prefix}${base}`;
148+
frame.abs_path = abs_path;
147149
}
148150
}
149151

packages/node/src/sdk/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +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: '',
7677
}),
7778
...getCjsOnlyIntegrations(),
7879
];

0 commit comments

Comments
 (0)