Skip to content

Commit

Permalink
fixed step output, fixed analyze plugin to work with reasoning model (#…
Browse files Browse the repository at this point in the history
…4810)

Co-authored-by: DavertMik <[email protected]>
  • Loading branch information
DavertMik and DavertMik authored Jan 31, 2025
1 parent 9aae736 commit 6865d84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ module.exports = {
}
}

let stepLine = step.toCliStyled()
let stepLine = step.toCliStyled ? step.toCliStyled() : step.toString()
if (step.metaStep && outputLevel >= 1) {
// this.stepShift += 2;
stepLine = colors.dim(truncate(stepLine, this.spaceShift))
Expand Down
11 changes: 5 additions & 6 deletions lib/plugin/analyze.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const debug = require('debug')('codeceptjs:analyze')
const { isMainThread } = require('node:worker_threads')
const { arrowRight } = require('figures')
const container = require('../container')
const store = require('../store')
const ai = require('../ai')
const colors = require('chalk')
const ora = require('ora-classic')
Expand Down Expand Up @@ -75,6 +76,7 @@ const defaultConfig = {
* SUMMARY <summary_of_errors>
* CATEGORY <category_of_failure>
* URL <url_of_failure_if_any>
* ERROR <error_message_1>, <error_message_2>, ...
* STEP <step_of_failure> (use CodeceptJS format I.click(), I.see(), etc; if all failures happend on the same step)
* SUITE <suite_title>, <suite_title> (if SUITE is present, and if all tests in the group have the same suite or suites)
Expand All @@ -86,11 +88,6 @@ const defaultConfig = {
x ...
`,
},
{
role: 'assistant',
content: `## '
`,
},
]
return messages
},
Expand Down Expand Up @@ -137,6 +134,7 @@ const defaultConfig = {
* ERROR <error_message_1>, <error_message_2>, ...
* CATEGORY <category_of_failure>
* STEPS <step_of_failure>
* URL <url_of_failure_if_any>
Do not add any other sections or explanations. Only CATEGORY, SUMMARY, STEPS.
${config.vision ? 'Also a screenshot of the page is attached to the prompt.' : ''}
Expand Down Expand Up @@ -338,12 +336,13 @@ function serializeTest(test) {
}

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

0 comments on commit 6865d84

Please sign in to comment.