Skip to content

Commit 91dab17

Browse files
fix: optionally print new table when invoked actions exist
1 parent 6f4a520 commit 91dab17

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/handleTestResults.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { stripVTControlCharacters } from 'node:util';
99
import { writeFile, mkdir } from 'node:fs/promises';
1010
import { AgentTestResultsResponse, convertTestResultsToFormat, humanFriendlyName, metric } from '@salesforce/agents';
1111
import { Ux } from '@salesforce/sf-plugins-core/Ux';
12+
import { ux as ocux } from '@oclif/core';
1213
import ansis from 'ansis';
1314

1415
async function writeFileToDir(outputDir: string, fileName: string, content: string): Promise<void> {
@@ -126,6 +127,31 @@ export function humanFormat(results: AgentTestResultsResponse): string {
126127
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
127128
metricResults.push(...metrics);
128129
}
130+
// it's not a real string[], more like just a string "[&#39;IdentifyRecordByName&#39;]"
131+
if (testCase.generatedData.actionsSequence.length > 2) {
132+
tables.push(
133+
ux.makeTable({
134+
title: 'Generated Data',
135+
columns: ['Data'],
136+
overflow: 'wrap',
137+
trimWhitespace: false,
138+
data: [
139+
{
140+
Data: ocux.colorizeJson(testCase.generatedData.invokedActions, {
141+
pretty: true,
142+
theme: {
143+
key: 'blueBright',
144+
string: 'greenBright',
145+
number: 'redBright',
146+
boolean: 'redBright',
147+
null: 'blackBright',
148+
},
149+
}),
150+
},
151+
],
152+
})
153+
);
154+
}
129155
// add a line break between end of the first table and the utterance of the next
130156
tables.push('\n');
131157
}

0 commit comments

Comments
 (0)