-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathtest.ts
82 lines (78 loc) · 2.66 KB
/
test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { join } from 'path';
import { createRunner } from '../../utils/runner';
describe('ContextLines integration in ESM', () => {
test('reads encoded 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 with space',
},
]),
},
},
],
},
},
})
.start(done);
});
});
describe('ContextLines integration in CJS', () => {
test('reads context lines from filenames with spaces', done => {
expect.assertions(1);
createRunner(__dirname, 'scenario with space.cjs')
.expect({
event: {
exception: {
values: [
{
value: 'Test Error',
stacktrace: {
frames: expect.arrayContaining([
{
filename: expect.stringMatching(/\/scenario with space.cjs$/),
context_line: "Sentry.captureException(new Error('Test Error'));",
pre_context: [
'',
'Sentry.init({',
" dsn: 'https://[email protected]/1337',",
" release: '1.0',",
' transport: loggingTransport,',
'});',
'',
],
post_context: ['', '// some more post context'],
colno: 25,
lineno: 10,
function: 'Object.?',
in_app: true,
module: 'scenario with space',
},
]),
},
},
],
},
},
})
.start(done);
});
});