-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtest.ts
More file actions
124 lines (121 loc) · 3.74 KB
/
test.ts
File metadata and controls
124 lines (121 loc) · 3.74 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import { afterAll, describe, expect, test } from 'vitest';
import { cleanupChildProcesses, createRunner } from '../../../utils/runner';
describe('logger public API', () => {
afterAll(() => {
cleanupChildProcesses();
});
test('captures logs with parameters in different forms', async () => {
const runner = createRunner(__dirname, 'subject.ts')
.expect({
log: {
items: [
{
attributes: {
foo: {
type: 'string',
value: 'bar1',
},
'sentry.sdk.name': {
type: 'string',
value: 'sentry.javascript.node',
},
'sentry.sdk.version': {
type: 'string',
value: expect.any(String),
},
'server.address': {
type: 'string',
value: 'M6QX4Q5HKV.local',
},
'user.name': {
type: 'string',
value: 'h4cktor',
},
},
body: 'test info',
level: 'info',
severity_number: 9,
timestamp: expect.any(Number),
trace_id: expect.stringMatching(/^[\da-f]{32}$/),
},
{
attributes: {
foo: {
type: 'string',
value: 'bar2',
},
'sentry.message.parameter.0': {
type: 'integer',
value: 1,
},
'sentry.message.template': {
type: 'string',
value: 'test info with %d',
},
'sentry.sdk.name': {
type: 'string',
value: 'sentry.javascript.node',
},
'sentry.sdk.version': {
type: 'string',
value: expect.any(String),
},
'server.address': {
type: 'string',
value: 'M6QX4Q5HKV.local',
},
'user.name': {
type: 'string',
value: 'h4cktor',
},
},
body: 'test info with 1',
level: 'info',
severity_number: 9,
timestamp: expect.any(Number),
trace_id: expect.stringMatching(/^[\da-f]{32}$/),
},
{
attributes: {
foo: {
type: 'string',
value: 'bar3',
},
'sentry.message.parameter.0': {
type: 'integer',
value: 1,
},
'sentry.message.template': {
type: 'string',
value: 'test info with fmt %s',
},
'sentry.sdk.name': {
type: 'string',
value: 'sentry.javascript.node',
},
'sentry.sdk.version': {
type: 'string',
value: expect.any(String),
},
'server.address': {
type: 'string',
value: 'M6QX4Q5HKV.local',
},
'user.name': {
type: 'string',
value: 'h4cktor',
},
},
body: 'test info with fmt 1',
level: 'info',
severity_number: 9,
timestamp: expect.any(Number),
trace_id: expect.stringMatching(/^[\da-f]{32}$/),
},
],
},
})
.start();
await runner.completed();
});
});