-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
dev-packages/node-integration-tests/suites/contextLines/instrument.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import * as Sentry from '@sentry/node'; | ||
import { loggingTransport } from '@sentry-internal/node-integration-tests'; | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
release: '1.0', | ||
autoSessionTracking: false, | ||
transport: loggingTransport, | ||
debug: true, | ||
}); |
5 changes: 5 additions & 0 deletions
5
dev-packages/node-integration-tests/suites/contextLines/scenario with space.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import * as Sentry from '@sentry/node'; | ||
|
||
Sentry.captureException(new Error('Test Error')); | ||
|
||
// some more post context |
39 changes: 39 additions & 0 deletions
39
dev-packages/node-integration-tests/suites/contextLines/test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { join } from 'path'; | ||
import { createRunner } from '../../utils/runner'; | ||
|
||
describe('ContextLines integration', () => { | ||
test('reads context lines from filenames with spaces', done => { | ||
expect.assertions(1); | ||
const instrumentPath = join(__dirname, 'instrument.mjs'); | ||
|
||
createRunner(__dirname, 'scenario with space.mjs') | ||
.withFlags('--import', instrumentPath) | ||
.expect({ | ||
event: { | ||
exception: { | ||
values: [ | ||
{ | ||
value: 'Test Error', | ||
stacktrace: { | ||
frames: expect.arrayContaining([ | ||
{ | ||
filename: expect.stringMatching(/\/scenario with space.mjs$/), | ||
context_line: "Sentry.captureException(new Error('Test Error'));", | ||
pre_context: ["import * as Sentry from '@sentry/node';", ''], | ||
post_context: ['', '// some more post context'], | ||
colno: 25, | ||
lineno: 3, | ||
function: '?', | ||
in_app: true, | ||
module: 'scenario%20with%20space', | ||
}, | ||
]), | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
}) | ||
.start(done); | ||
}); | ||
}); |