@@ -2,6 +2,7 @@ const debug = require('debug')('codeceptjs:analyze')
22const { isMainThread } = require ( 'node:worker_threads' )
33const { arrowRight } = require ( 'figures' )
44const container = require ( '../container' )
5+ const store = require ( '../store' )
56const ai = require ( '../ai' )
67const colors = require ( 'chalk' )
78const 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
340338function formatResponse ( response ) {
341- if ( ! response . startsWith ( '##' ) ) response = '## ' + response
342339 return response
340+ . replace ( / < t h i n k > ( [ \s \S ] * ?) < \/ t h i n k > / 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