@@ -2,6 +2,7 @@ const debug = require('debug')('codeceptjs:analyze')
2
2
const { isMainThread } = require ( 'node:worker_threads' )
3
3
const { arrowRight } = require ( 'figures' )
4
4
const container = require ( '../container' )
5
+ const store = require ( '../store' )
5
6
const ai = require ( '../ai' )
6
7
const colors = require ( 'chalk' )
7
8
const ora = require ( 'ora-classic' )
@@ -75,6 +76,7 @@ const defaultConfig = {
75
76
76
77
* SUMMARY <summary_of_errors>
77
78
* CATEGORY <category_of_failure>
79
+ * URL <url_of_failure_if_any>
78
80
* ERROR <error_message_1>, <error_message_2>, ...
79
81
* STEP <step_of_failure> (use CodeceptJS format I.click(), I.see(), etc; if all failures happend on the same step)
80
82
* 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 = {
86
88
x ...
87
89
` ,
88
90
} ,
89
- {
90
- role : 'assistant' ,
91
- content : `## '
92
- ` ,
93
- } ,
94
91
]
95
92
return messages
96
93
} ,
@@ -137,6 +134,7 @@ const defaultConfig = {
137
134
* ERROR <error_message_1>, <error_message_2>, ...
138
135
* CATEGORY <category_of_failure>
139
136
* STEPS <step_of_failure>
137
+ * URL <url_of_failure_if_any>
140
138
141
139
Do not add any other sections or explanations. Only CATEGORY, SUMMARY, STEPS.
142
140
${ config . vision ? 'Also a screenshot of the page is attached to the prompt.' : '' }
@@ -338,12 +336,13 @@ function serializeTest(test) {
338
336
}
339
337
340
338
function formatResponse ( response ) {
341
- if ( ! response . startsWith ( '##' ) ) response = '## ' + response
342
339
return response
340
+ . replace ( / < t h i n k > ( [ \s \S ] * ?) < \/ t h i n k > / g, store . debugMode ? colors . cyan ( '$1' ) : '' )
343
341
. split ( '\n' )
344
342
. map ( line => line . trim ( ) )
345
343
. filter ( line => ! / ^ [ A - Z \s ] + $ / . test ( line ) )
346
344
. map ( line => markdownToAnsi ( line ) )
347
345
. map ( line => line . replace ( / ^ x / gm, ` ${ colors . red . bold ( 'x' ) } ` ) )
348
346
. join ( '\n' )
347
+ . trim ( )
349
348
}
0 commit comments