diff --git a/e2e/expect/test/soft.test.ts b/e2e/expect/test/soft.test.ts index b7a050a3e..e5c403391 100644 --- a/e2e/expect/test/soft.test.ts +++ b/e2e/expect/test/soft.test.ts @@ -29,6 +29,7 @@ describe('Expect Soft API', () => { logs.find((log) => log.includes('AssertionError: expected 3 to be 4')), ).toBeTruthy(); expect(cli.stdout).toContain('✓ expect.soft retry can recover'); + expect(cli.stdout).toContain('Previous failure: expected 1 to be 2'); expect( logs.filter((log) => log.includes('AssertionError: expected 1 to be 100'), diff --git a/e2e/rstest.config.mts b/e2e/rstest.config.mts index 5c1d95ecf..5c01ee67f 100644 --- a/e2e/rstest.config.mts +++ b/e2e/rstest.config.mts @@ -40,6 +40,19 @@ export default defineConfig({ // Retry failed test cases in CI to reduce flaky failures without rerunning // the whole suite; keep local runs strict for faster feedback. retry: process.env.CI ? 2 : 0, + reporters: process.env.CI + ? [ + 'default', + [ + 'github-actions', + { + summary: { + maxCharsPerField: 10_000, + }, + }, + ], + ] + : ['default'], slowTestThreshold: 2_000, // Stabilize date/time based e2e fixtures across different runner timezones. // Some fixtures use `new Date('YYYY-MM-DD')` (UTC parsing) but assert on local diff --git a/packages/core/src/reporter/utils.ts b/packages/core/src/reporter/utils.ts index 95d574165..540335343 100644 --- a/packages/core/src/reporter/utils.ts +++ b/packages/core/src/reporter/utils.ts @@ -169,9 +169,14 @@ export const logCase = ( logger.log(` ${icon} ${nameStr}${color.gray(duration)}${retry}${heap}`); - if (result.errors) { - for (const error of result.errors) { - logger.log(color.red(` ${error.message}`)); + const errors = result.status === 'pass' ? result.retryErrors : result.errors; + if (errors) { + for (const error of errors) { + const message = + result.status === 'pass' + ? `Previous failure: ${error.message}` + : error.message; + logger.log(color.red(` ${message}`)); } } };