From 5a42588e18169b1bdd26b46d4afd1126bd361cf7 Mon Sep 17 00:00:00 2001 From: Jonas Amundsen Date: Sat, 20 Jul 2024 18:35:24 +0200 Subject: [PATCH] Omit outputting empty "then" entries to the command log Relates to #1214 [1]. This is unfortunately highly dependant on Cypress' implementation details and cumbersome (at best) to test. Hopefully this doesn't have any adverse side effects. [1] https://github.com/badeball/cypress-cucumber-preprocessor/discussions/1214 --- CHANGELOG.md | 4 ++++ lib/helpers/cypress.ts | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2715c437..374efadf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. +## Unreleased + +- Omit outputting empty "then" entries to the command log, relates to [#1214](https://github.com/badeball/cypress-cucumber-preprocessor/discussions/1214). + ## v20.1.0 - Include skipped (not omitted) tests in reports, fixes [#1041](https://github.com/badeball/cypress-cucumber-preprocessor/issues/1041). diff --git a/lib/helpers/cypress.ts b/lib/helpers/cypress.ts index 1433bf27..9479f7f8 100644 --- a/lib/helpers/cypress.ts +++ b/lib/helpers/cypress.ts @@ -43,7 +43,7 @@ export function runStepWithLogGroup(options: { argument?: DataTable | string; text?: string; }) { - Cypress.log({ + const log = Cypress.log({ name: options.keyword, message: options.text == null ? "" : `**${options.text}**`, groupStart: true, @@ -71,7 +71,7 @@ export function runStepWithLogGroup(options: { } return ensureChain(ret).then((result) => { - Cypress.log({ groupEnd: true, emitOnly: true } as object); + (log as any).endGroup(); return result; }); }