diff --git a/src/steps/finder.ts b/src/steps/finder.ts index a9f03fe2..d6948185 100644 --- a/src/steps/finder.ts +++ b/src/steps/finder.ts @@ -62,9 +62,8 @@ export function formatDuplicateStepsMessage( }); return [ - `Multiple step definitions found!`, - `Step: ${stepTextWithKeyword}`, - `File: ${stepLocation}`, + `Multiple definitions (${matchedSteps.length}) matched scenario step!`, + `Step: ${stepTextWithKeyword} # ${stepLocation}`, ...stepLines, ].join('\n'); } diff --git a/test/duplicate-steps/test.mjs b/test/duplicate-steps/test.mjs index e95abd0b..50fca023 100644 --- a/test/duplicate-steps/test.mjs +++ b/test/duplicate-steps/test.mjs @@ -10,9 +10,8 @@ const testDir = new TestDir(import.meta); test(`${testDir.name} (main thread - regular steps)`, () => { const error = [ - `Multiple step definitions found`, - `Step: Given duplicate step`, - `File: ${normalize('features/sample.feature:5:5')}`, + `Multiple definitions (3) matched scenario step`, + `Step: Given duplicate step # ${normalize('features/sample.feature:5:5')}`, ` - Given 'duplicate step' # ${normalize('steps/steps.ts')}:6`, ` - Given 'duplicate step' # ${normalize('steps/steps.ts')}:7`, ` - Given 'duplicate step' # ${normalize('steps/steps.ts')}:8`, @@ -25,9 +24,8 @@ test(`${testDir.name} (main thread - regular steps)`, () => { test(`${testDir.name} (main thread - decorator steps)`, () => { const error = [ - `Multiple step definitions found`, - `Step: Given duplicate decorator step`, - `File: ${normalize('features/sample.feature:9:5')}`, + `Multiple definitions (3) matched scenario step`, + `Step: Given duplicate decorator step # ${normalize('features/sample.feature:9:5')}`, ` - Given 'duplicate decorator step' # ${normalize('steps/TodoPage.ts')}:7`, ` - Given 'duplicate decorator step' # ${normalize('steps/TodoPage.ts')}:10`, ` - Given 'duplicate decorator step' # ${normalize('steps/TodoPage.ts')}:13`, @@ -40,9 +38,8 @@ test(`${testDir.name} (main thread - decorator steps)`, () => { test(`${testDir.name} (worker - regular steps)`, () => { const error = [ - `Multiple step definitions found`, - `Step: Given duplicate step`, - `File: ${normalize('features/sample.feature:5:5')}`, + `Multiple definitions (3) matched scenario step`, + `Step: Given duplicate step # ${normalize('features/sample.feature:5:5')}`, ` - Given 'duplicate step' # ${normalize('steps/steps.ts')}:6`, ` - Given 'duplicate step' # ${normalize('steps/steps.ts')}:7`, ` - Given 'duplicate step' # ${normalize('steps/steps.ts')}:8`, diff --git a/test/match-keywords/test.mjs b/test/match-keywords/test.mjs index 18051375..c4e099da 100644 --- a/test/match-keywords/test.mjs +++ b/test/match-keywords/test.mjs @@ -16,11 +16,10 @@ test(`${testDir.name} (fail)`, () => { execPlaywrightTestWithError( testDir.name, [ - `Multiple step definitions found`, // prettier-ignore - `Step: Given duplicate step 1`, - `File: ${normalize('features/fail/sample.feature:4:5')}`, - `Given 'duplicate step 1' # ${normalize('features/fail/steps.ts:5')}`, - `Given 'duplicate step {int}' # ${normalize('features/fail/steps.ts:6')}`, + `Multiple definitions (2) matched scenario step`, // prettier-ignore + `Step: Given duplicate step 1 # ${normalize('features/fail/sample.feature:4:5')}`, + `- Given 'duplicate step 1' # ${normalize('features/fail/steps.ts:5')}`, + `- Given 'duplicate step {int}' # ${normalize('features/fail/steps.ts:6')}`, ], { env: { PROJECT: 'fail' } }, );