diff --git a/lib/plugin/analyze.js b/lib/plugin/analyze.js index 7f79fa2bb..e92e38a3a 100644 --- a/lib/plugin/analyze.js +++ b/lib/plugin/analyze.js @@ -32,10 +32,10 @@ const defaultConfig = { .map((test, index) => { if (!test || !test.err) return return ` - TEST #${index + 1}: ${serializeTest(test)} - ERROR: ${serializeError(test.err).slice(0, MAX_DATA_LENGTH / tests.length)}` + #${index + 1}: ${serializeTest(test)} + ${serializeError(test.err).slice(0, MAX_DATA_LENGTH / tests.length)}`.trim() }) - .join('\n\n---\n\n') + .join('\n\n--------\n\n') const messages = [ { @@ -60,25 +60,29 @@ const defaultConfig = { If there is no groups of tests, say: "No patterns found" Preserve error messages but cut them if they are too long. Respond clearly and directly, without introductory words or phrases like ‘Of course,’ ‘Here is the answer,’ etc. - Do not list more than 3 tests in the group. Do not list more than 3 errors in the group. If you identify that all tests in the group have the same tag, add this tag to the group report, otherwise ignore TAG section. If you identify that all tests in the group have the same suite, add this suite to the group report, otherwise ignore SUITE section. Pick different emojis for each group. + Do not include group into report if it has only one test in affected tests section. Provide list of groups in following format: _______________________________ - ## Group <(percentage of failed tests in group compare to all failed tests)'> + ## Group * CATEGORY * ERROR , , ... * SUMMARY - * STEP (in format I.click(), I.see(), etc; if all failures happend on the same step) - * AFFECTED TESTS () - * SUITE , (only if all tests in the group have the same suite or suites) - * TAG (if all tags in group have the same tag) + * STEP (use CodeceptJS format I.click(), I.see(), etc; if all failures happend on the same step) + * SUITE , (if SUITE is present, and if all tests in the group have the same suite or suites) + * TAG (if TAG is present, and if all tests in the group have the same tag) + * AFFECTED TESTS (): + x + x + x + x ... `, }, { @@ -318,9 +322,12 @@ function serializeTest(test) { if (test.suite) { testMessage += '\n SUITE: ' + test.suite.title } + if (test.parent) { + testMessage += '\n SUITE: ' + test.parent.title + } if (test.steps?.length) { - const failedSteps = test.steps.filter(s => s.status === 'failed') + const failedSteps = test.steps if (failedSteps.length) testMessage += '\n STEP: ' + failedSteps.map(s => s.toCode()).join('; ') } @@ -339,5 +346,6 @@ function formatResponse(response) { .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') }