Adding session id as part of json o/p (#14504)

This commit is contained in:
Jainam M
2025-12-04 22:36:20 +05:30
committed by GitHub
parent 84f521b1c6
commit 8b0a8f47c1
8 changed files with 126 additions and 27 deletions
+25 -3
View File
@@ -637,7 +637,11 @@ describe('runNonInteractive', () => {
);
expect(processStdoutSpy).toHaveBeenCalledWith(
JSON.stringify(
{ response: 'Hello World', stats: MOCK_SESSION_METRICS },
{
session_id: 'test-session-id',
response: 'Hello World',
stats: MOCK_SESSION_METRICS,
},
null,
2,
),
@@ -720,7 +724,15 @@ describe('runNonInteractive', () => {
// This should output JSON with empty response but include stats
expect(processStdoutSpy).toHaveBeenCalledWith(
JSON.stringify({ response: '', stats: MOCK_SESSION_METRICS }, null, 2),
JSON.stringify(
{
session_id: 'test-session-id',
response: '',
stats: MOCK_SESSION_METRICS,
},
null,
2,
),
);
});
@@ -755,7 +767,15 @@ describe('runNonInteractive', () => {
// This should output JSON with empty response but include stats
expect(processStdoutSpy).toHaveBeenCalledWith(
JSON.stringify({ response: '', stats: MOCK_SESSION_METRICS }, null, 2),
JSON.stringify(
{
session_id: 'test-session-id',
response: '',
stats: MOCK_SESSION_METRICS,
},
null,
2,
),
);
});
@@ -792,6 +812,7 @@ describe('runNonInteractive', () => {
expect(consoleErrorJsonSpy).toHaveBeenCalledWith(
JSON.stringify(
{
session_id: 'test-session-id',
error: {
type: 'Error',
message: 'Invalid input provided',
@@ -837,6 +858,7 @@ describe('runNonInteractive', () => {
expect(consoleErrorJsonSpy).toHaveBeenCalledWith(
JSON.stringify(
{
session_id: 'test-session-id',
error: {
type: 'FatalInputError',
message: 'Invalid command syntax provided',