File tree 3 files changed +54
-0
lines changed
dev-packages/node-integration-tests/suites/contextLines
3 files changed +54
-0
lines changed Original file line number Diff line number Diff line change
1
+ import * as Sentry from '@sentry/node' ;
2
+ import { loggingTransport } from '@sentry-internal/node-integration-tests' ;
3
+
4
+ Sentry . init ( {
5
+ dsn : 'https://public@dsn.ingest.sentry.io/1337' ,
6
+ release : '1.0' ,
7
+ autoSessionTracking : false ,
8
+ transport : loggingTransport ,
9
+ debug : true ,
10
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import * as Sentry from '@sentry/node' ;
2
+
3
+ Sentry . captureException ( new Error ( 'Test Error' ) ) ;
4
+
5
+ // some more post context
Original file line number Diff line number Diff line change
1
+ import { join } from 'path' ;
2
+ import { createRunner } from '../../utils/runner' ;
3
+
4
+ describe ( 'ContextLines integration' , ( ) => {
5
+ test ( 'reads context lines from filenames with spaces' , done => {
6
+ expect . assertions ( 1 ) ;
7
+ const instrumentPath = join ( __dirname , 'instrument.mjs' ) ;
8
+
9
+ createRunner ( __dirname , 'scenario with space.mjs' )
10
+ . withFlags ( '--import' , instrumentPath )
11
+ . expect ( {
12
+ event : {
13
+ exception : {
14
+ values : [
15
+ {
16
+ value : 'Test Error' ,
17
+ stacktrace : {
18
+ frames : expect . arrayContaining ( [
19
+ {
20
+ filename : expect . stringMatching ( / \/ s c e n a r i o w i t h s p a c e .m j s $ / ) ,
21
+ context_line : "Sentry.captureException(new Error('Test Error'));" ,
22
+ pre_context : [ "import * as Sentry from '@sentry/node';" , '' ] ,
23
+ post_context : [ '' , '// some more post context' ] ,
24
+ colno : 25 ,
25
+ lineno : 3 ,
26
+ function : '?' ,
27
+ in_app : true ,
28
+ module : 'scenario%20with%20space' ,
29
+ } ,
30
+ ] ) ,
31
+ } ,
32
+ } ,
33
+ ] ,
34
+ } ,
35
+ } ,
36
+ } )
37
+ . start ( done ) ;
38
+ } ) ;
39
+ } ) ;
You can’t perform that action at this time.
0 commit comments