-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtest.ts
More file actions
91 lines (87 loc) · 3.19 KB
/
test.ts
File metadata and controls
91 lines (87 loc) · 3.19 KB
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
83
84
85
86
87
88
89
90
91
import { join } from 'path';
import { describe, expect, test } from 'vitest';
import { createRunner } from '../../../utils/runner';
describe('ContextLines integration in ESM', () => {
test('reads encoded context lines from filenames with spaces', async () => {
expect.assertions(1);
const instrumentPath = join(__dirname, 'instrument.mjs');
await createRunner(__dirname, 'scenario with space.mjs')
.withInstrument(instrumentPath)
.expect({
event: {
exception: {
values: [
{
value: 'Test Error',
stacktrace: {
frames: expect.arrayContaining([
{
filename: '/suites/contextLines/filename-with-spaces/scenario with space.mjs',
abs_path: expect.stringContaining(
'/dev-packages/node-integration-tests/suites/contextLines/filename-with-spaces/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()
.completed();
});
});
describe('ContextLines integration in CJS', () => {
test('reads context lines from filenames with spaces', async () => {
expect.assertions(1);
await createRunner(__dirname, 'scenario with space.cjs')
.expect({
event: {
exception: {
values: [
{
value: 'Test Error',
stacktrace: {
frames: expect.arrayContaining([
{
filename: '/suites/contextLines/filename-with-spaces/scenario with space.cjs',
abs_path: expect.stringContaining(
'/dev-packages/node-integration-tests/suites/contextLines/filename-with-spaces/scenario with space.cjs',
),
context_line: "Sentry.captureException(new Error('Test Error'));",
pre_context: [
'',
'Sentry.init({',
" dsn: 'https://public@dsn.ingest.sentry.io/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()
.completed();
});
});