Skip to content

Commit 58aaf24

Browse files
committed
fix all tests
1 parent 9376f7f commit 58aaf24

File tree

2 files changed

+245
-24
lines changed

2 files changed

+245
-24
lines changed

dev-packages/browser-integration-tests/suites/public-api/logger/subject.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,16 @@ Sentry.logger.info('test info');
44
Sentry.logger.warn('test warn');
55
Sentry.logger.error('test error');
66
Sentry.logger.fatal('test fatal');
7-
Sentry.logger.critical('test critical');
87

9-
const formattedMessage = (message, ...args) => {
10-
return Sentry.logger.fmt`test ${message} ${args}`;
8+
const formattedMessage = (message, stringArg, boolArg, numberArg) => {
9+
return Sentry.logger.fmt`test ${message} ${stringArg} ${boolArg} ${numberArg}`;
1110
};
1211

13-
Sentry.logger.trace(formattedMessage('trace', 'stringArg', 123));
14-
Sentry.logger.debug(formattedMessage('debug', 'stringArg', 123));
15-
Sentry.logger.info(formattedMessage('info', 'stringArg', 123));
16-
Sentry.logger.warn(formattedMessage('warn', 'stringArg', 123));
17-
Sentry.logger.error(formattedMessage('error', 'stringArg', 123));
18-
Sentry.logger.fatal(formattedMessage('fatal', 'stringArg', 123));
19-
Sentry.logger.critical(formattedMessage('critical', 'stringArg', 123));
12+
Sentry.logger.trace(formattedMessage('trace', 'stringArg', false, 123));
13+
Sentry.logger.debug(formattedMessage('debug', 'stringArg', false, 123));
14+
Sentry.logger.info(formattedMessage('info', 'stringArg', false, 123));
15+
Sentry.logger.warn(formattedMessage('warn', 'stringArg', false, 123));
16+
Sentry.logger.error(formattedMessage('error', 'stringArg', false, 123));
17+
Sentry.logger.fatal(formattedMessage('fatal', 'stringArg', false, 123));
2018

2119
Sentry.flush();

dev-packages/browser-integration-tests/suites/public-api/logger/test.ts

Lines changed: 237 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ sentryTest('should capture all logging methods', async ({ getLocalTestUrl, page
1313

1414
expect(envelopeHeader).toEqual({ sdk: { name: 'sentry.javascript.browser', version: expect.any(String) } });
1515

16-
expect(envelopeItems.length).toBe(14);
16+
expect(envelopeItems.length).toBe(12);
1717

1818
expect(envelopeItems[0]).toEqual([
1919
{
@@ -53,7 +53,7 @@ sentryTest('should capture all logging methods', async ({ getLocalTestUrl, page
5353
attributes: [],
5454
timeUnixNano: expect.any(String),
5555
traceId: expect.any(String),
56-
severityNumber: 1,
56+
severityNumber: 9,
5757
},
5858
]);
5959

@@ -67,7 +67,7 @@ sentryTest('should capture all logging methods', async ({ getLocalTestUrl, page
6767
attributes: [],
6868
timeUnixNano: expect.any(String),
6969
traceId: expect.any(String),
70-
severityNumber: 1,
70+
severityNumber: 13,
7171
},
7272
]);
7373

@@ -81,7 +81,7 @@ sentryTest('should capture all logging methods', async ({ getLocalTestUrl, page
8181
attributes: [],
8282
timeUnixNano: expect.any(String),
8383
traceId: expect.any(String),
84-
severityNumber: 1,
84+
severityNumber: 17,
8585
},
8686
]);
8787

@@ -95,7 +95,7 @@ sentryTest('should capture all logging methods', async ({ getLocalTestUrl, page
9595
attributes: [],
9696
timeUnixNano: expect.any(String),
9797
traceId: expect.any(String),
98-
severityNumber: 1,
98+
severityNumber: 21,
9999
},
100100
]);
101101

@@ -104,9 +104,40 @@ sentryTest('should capture all logging methods', async ({ getLocalTestUrl, page
104104
type: 'otel_log',
105105
},
106106
{
107-
severityText: 'critical',
108-
body: { stringValue: 'test critical' },
109-
attributes: [],
107+
severityText: 'trace',
108+
body: { stringValue: 'test trace stringArg false 123' },
109+
attributes: [
110+
{
111+
key: 'sentry.message.template',
112+
value: {
113+
stringValue: 'test %s %s %s %s',
114+
},
115+
},
116+
{
117+
key: 'sentry.message.param.0',
118+
value: {
119+
stringValue: 'trace',
120+
},
121+
},
122+
{
123+
key: 'sentry.message.param.1',
124+
value: {
125+
stringValue: 'stringArg',
126+
},
127+
},
128+
{
129+
key: 'sentry.message.param.2',
130+
value: {
131+
boolValue: false,
132+
},
133+
},
134+
{
135+
key: 'sentry.message.param.3',
136+
value: {
137+
doubleValue: 123,
138+
},
139+
},
140+
],
110141
timeUnixNano: expect.any(String),
111142
traceId: expect.any(String),
112143
severityNumber: 1,
@@ -118,31 +149,223 @@ sentryTest('should capture all logging methods', async ({ getLocalTestUrl, page
118149
type: 'otel_log',
119150
},
120151
{
121-
severityText: 'trace',
122-
body: { stringValue: 'test trace stringArg 123' },
152+
severityText: 'debug',
153+
body: { stringValue: 'test debug stringArg false 123' },
123154
attributes: [
124155
{
125156
key: 'sentry.message.template',
126157
value: {
127-
stringValue: 'test %s %s',
158+
stringValue: 'test %s %s %s %s',
128159
},
129160
},
130161
{
131-
key: 'sentry.message.params.0',
162+
key: 'sentry.message.param.0',
163+
value: {
164+
stringValue: 'debug',
165+
},
166+
},
167+
{
168+
key: 'sentry.message.param.1',
132169
value: {
133170
stringValue: 'stringArg',
134171
},
135172
},
136173
{
137-
key: 'sentry.message.params.1',
174+
key: 'sentry.message.param.2',
175+
value: {
176+
boolValue: false,
177+
},
178+
},
179+
{
180+
key: 'sentry.message.param.3',
138181
value: {
139182
doubleValue: 123,
140183
},
141184
},
142185
],
143186
timeUnixNano: expect.any(String),
144187
traceId: expect.any(String),
145-
severityNumber: 1,
188+
severityNumber: 5,
189+
},
190+
]);
191+
192+
expect(envelopeItems[8]).toEqual([
193+
{
194+
type: 'otel_log',
195+
},
196+
{
197+
severityText: 'info',
198+
body: { stringValue: 'test info stringArg false 123' },
199+
attributes: [
200+
{
201+
key: 'sentry.message.template',
202+
value: {
203+
stringValue: 'test %s %s %s %s',
204+
},
205+
},
206+
{
207+
key: 'sentry.message.param.0',
208+
value: {
209+
stringValue: 'info',
210+
},
211+
},
212+
{
213+
key: 'sentry.message.param.1',
214+
value: {
215+
stringValue: 'stringArg',
216+
},
217+
},
218+
{
219+
key: 'sentry.message.param.2',
220+
value: {
221+
boolValue: false,
222+
},
223+
},
224+
{
225+
key: 'sentry.message.param.3',
226+
value: {
227+
doubleValue: 123,
228+
},
229+
},
230+
],
231+
timeUnixNano: expect.any(String),
232+
traceId: expect.any(String),
233+
severityNumber: 9,
234+
},
235+
]);
236+
237+
expect(envelopeItems[9]).toEqual([
238+
{
239+
type: 'otel_log',
240+
},
241+
{
242+
severityText: 'warn',
243+
body: { stringValue: 'test warn stringArg false 123' },
244+
attributes: [
245+
{
246+
key: 'sentry.message.template',
247+
value: {
248+
stringValue: 'test %s %s %s %s',
249+
},
250+
},
251+
{
252+
key: 'sentry.message.param.0',
253+
value: {
254+
stringValue: 'warn',
255+
},
256+
},
257+
{
258+
key: 'sentry.message.param.1',
259+
value: {
260+
stringValue: 'stringArg',
261+
},
262+
},
263+
{
264+
key: 'sentry.message.param.2',
265+
value: {
266+
boolValue: false,
267+
},
268+
},
269+
{
270+
key: 'sentry.message.param.3',
271+
value: {
272+
doubleValue: 123,
273+
},
274+
},
275+
],
276+
timeUnixNano: expect.any(String),
277+
traceId: expect.any(String),
278+
severityNumber: 13,
279+
},
280+
]);
281+
282+
expect(envelopeItems[10]).toEqual([
283+
{
284+
type: 'otel_log',
285+
},
286+
{
287+
severityText: 'error',
288+
body: { stringValue: 'test error stringArg false 123' },
289+
attributes: [
290+
{
291+
key: 'sentry.message.template',
292+
value: {
293+
stringValue: 'test %s %s %s %s',
294+
},
295+
},
296+
{
297+
key: 'sentry.message.param.0',
298+
value: {
299+
stringValue: 'error',
300+
},
301+
},
302+
{
303+
key: 'sentry.message.param.1',
304+
value: {
305+
stringValue: 'stringArg',
306+
},
307+
},
308+
{
309+
key: 'sentry.message.param.2',
310+
value: {
311+
boolValue: false,
312+
},
313+
},
314+
{
315+
key: 'sentry.message.param.3',
316+
value: {
317+
doubleValue: 123,
318+
},
319+
},
320+
],
321+
timeUnixNano: expect.any(String),
322+
traceId: expect.any(String),
323+
severityNumber: 17,
324+
},
325+
]);
326+
327+
expect(envelopeItems[11]).toEqual([
328+
{
329+
type: 'otel_log',
330+
},
331+
{
332+
severityText: 'fatal',
333+
body: { stringValue: 'test fatal stringArg false 123' },
334+
attributes: [
335+
{
336+
key: 'sentry.message.template',
337+
value: {
338+
stringValue: 'test %s %s %s %s',
339+
},
340+
},
341+
{
342+
key: 'sentry.message.param.0',
343+
value: {
344+
stringValue: 'fatal',
345+
},
346+
},
347+
{
348+
key: 'sentry.message.param.1',
349+
value: {
350+
stringValue: 'stringArg',
351+
},
352+
},
353+
{
354+
key: 'sentry.message.param.2',
355+
value: {
356+
boolValue: false,
357+
},
358+
},
359+
{
360+
key: 'sentry.message.param.3',
361+
value: {
362+
doubleValue: 123,
363+
},
364+
},
365+
],
366+
timeUnixNano: expect.any(String),
367+
traceId: expect.any(String),
368+
severityNumber: 21,
146369
},
147370
]);
148371
});

0 commit comments

Comments
 (0)