Skip to content

Commit 44ce3bb

Browse files
committed
add mixed data consola message
1 parent 7b501c2 commit 44ce3bb

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

dev-packages/node-integration-tests/suites/consola/subject-special-objects.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,17 @@ async function run(): Promise<void> {
2828
// Test Map and Set objects are preserved
2929
consola.info('Collections:', new Map([['key', 'value']]), new Set([1, 2, 3]));
3030

31-
// Test mixed: plain object + special object
32-
consola.info('Mixed data', { userId: 123 }, new Date('2023-06-15T12:00:00.000Z'));
31+
// Test mixed: nested object, primitives, Date, and Map
32+
consola.info(
33+
'Mixed data',
34+
{ userId: 123, nestedMetadata: { id: 789, name: 'Jane', source: 'api' } },
35+
new Date('2023-06-15T12:00:00.000Z'),
36+
'a-simple-string',
37+
new Map([['key', 'value']]),
38+
);
3339

3440
await Sentry.flush();
3541
}
3642

3743
// eslint-disable-next-line @typescript-eslint/no-floating-promises
3844
void run();
39-

dev-packages/node-integration-tests/suites/consola/test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ describe('consola integration', () => {
706706
{
707707
timestamp: expect.any(Number),
708708
level: 'info',
709-
body: 'Mixed data',
709+
body: 'Mixed data a-simple-string',
710710
severity_number: expect.any(Number),
711711
trace_id: expect.any(String),
712712
attributes: {
@@ -718,10 +718,14 @@ describe('consola integration', () => {
718718
'server.address': { value: expect.any(String), type: 'string' },
719719
'consola.type': { value: 'info', type: 'string' },
720720
'consola.level': { value: 3, type: 'integer' },
721-
// Plain object properties are extracted
721+
// Plain object properties extracted
722722
userId: { value: 123, type: 'integer' },
723-
// Date is preserved in context
723+
// Nested metadata object normalized (depth 3)
724+
nestedMetadata: { value: '{"id":789,"name":"Jane","source":"api"}', type: 'string' },
725+
// Date preserved as args
724726
'consola.args.0': { value: '"2023-06-15T12:00:00.000Z"', type: 'string' },
727+
// Map converted to object and stored as args
728+
'consola.args.1': { value: '{"key":"value"}', type: 'string' },
725729
},
726730
},
727731
],

0 commit comments

Comments
 (0)