Skip to content

Commit 6865d84

Browse files
DavertMikDavertMik
and
DavertMik
authored
fixed step output, fixed analyze plugin to work with reasoning model (#4810)
Co-authored-by: DavertMik <davert@testomat.io>
1 parent 9aae736 commit 6865d84

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

lib/output.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ module.exports = {
115115
}
116116
}
117117

118-
let stepLine = step.toCliStyled()
118+
let stepLine = step.toCliStyled ? step.toCliStyled() : step.toString()
119119
if (step.metaStep && outputLevel >= 1) {
120120
// this.stepShift += 2;
121121
stepLine = colors.dim(truncate(stepLine, this.spaceShift))

lib/plugin/analyze.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const debug = require('debug')('codeceptjs:analyze')
22
const { isMainThread } = require('node:worker_threads')
33
const { arrowRight } = require('figures')
44
const container = require('../container')
5+
const store = require('../store')
56
const ai = require('../ai')
67
const colors = require('chalk')
78
const ora = require('ora-classic')
@@ -75,6 +76,7 @@ const defaultConfig = {
7576
7677
* SUMMARY <summary_of_errors>
7778
* CATEGORY <category_of_failure>
79+
* URL <url_of_failure_if_any>
7880
* ERROR <error_message_1>, <error_message_2>, ...
7981
* STEP <step_of_failure> (use CodeceptJS format I.click(), I.see(), etc; if all failures happend on the same step)
8082
* SUITE <suite_title>, <suite_title> (if SUITE is present, and if all tests in the group have the same suite or suites)
@@ -86,11 +88,6 @@ const defaultConfig = {
8688
x ...
8789
`,
8890
},
89-
{
90-
role: 'assistant',
91-
content: `## '
92-
`,
93-
},
9491
]
9592
return messages
9693
},
@@ -137,6 +134,7 @@ const defaultConfig = {
137134
* ERROR <error_message_1>, <error_message_2>, ...
138135
* CATEGORY <category_of_failure>
139136
* STEPS <step_of_failure>
137+
* URL <url_of_failure_if_any>
140138
141139
Do not add any other sections or explanations. Only CATEGORY, SUMMARY, STEPS.
142140
${config.vision ? 'Also a screenshot of the page is attached to the prompt.' : ''}
@@ -338,12 +336,13 @@ function serializeTest(test) {
338336
}
339337

340338
function formatResponse(response) {
341-
if (!response.startsWith('##')) response = '## ' + response
342339
return response
340+
.replace(/<think>([\s\S]*?)<\/think>/g, store.debugMode ? colors.cyan('$1') : '')
343341
.split('\n')
344342
.map(line => line.trim())
345343
.filter(line => !/^[A-Z\s]+$/.test(line))
346344
.map(line => markdownToAnsi(line))
347345
.map(line => line.replace(/^x /gm, ` ${colors.red.bold('x')} `))
348346
.join('\n')
347+
.trim()
349348
}

0 commit comments

Comments
 (0)