Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed step output, fixed analyze plugin to work with reasoning model #4810

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
}
Loading