Skip to content

Failed Before hook not present in report #359

@Llois41

Description

@Llois41

Environment (please complete the following information)

  • multiple-cucumber-html-reporter: 3.6.2
  • Node.js version: 20.15.1
  • NPM version: yarn v4.3.0
  • Cucumber version: 10.8.0

Config of multiple-cucumber-html-reporter

import { type Options } from 'multiple-cucumber-html-reporter';

function createGenerateOptions(inputDirectory: string): Options {
  return {
    displayDuration: true,
    displayReportTime: true,
    jsonDir: inputDirectory,
    reportPath: `${inputDirectory}report/`,
    pageTitle: 'UI/E2E Test Report',
    customData: {
      title: 'Run Configuration',
      data: [
        { label: 'Version', value: process.env.PACKAGE_VERSION },
        { label: 'Branch', value: process.env.CI_COMMIT_REF_SLUG },
        { label: 'Date (UTC)', value: new Date().toISOString() },
      ],
    },
  };
}

Describe the bug

When having a Before hook in the .json input file the reporter does not add it to the report even if it has failed. However the After hook is present in the report.

To Reproduce

Use following .json output from the cucumber tests as input for the reporter

[
  {
    "description": "",
    "elements": [
      {
        "description": "",
        "id": "some test id",
        "keyword": "Szenario",
        "line": 9,
        "name": "TC-WEB-ST-01-1: some name",
        "steps": [
          {
            "keyword": "Before",
            "hidden": true,
            "result": {
              "status": "failed",
              "duration": 476208,
              "error_message": "Error: provoke failure\n    at someFile.<anonymous> (file:///Users/xxx/someScript.mjs:1:23)"
            }
          },
          {
            "keyword": "Before",
            "hidden": true,
            "result": {
              "status": "skipped",
              "duration": 0
            }
          },
          {
            "keyword": "Before",
            "hidden": true,
            "result": {
              "status": "skipped",
              "duration": 0
            }
          },
          {
            "keyword": "Before",
            "hidden": true,
            "result": {
              "status": "skipped",
              "duration": 0
            }
          },
          {
            "arguments": [],
            "keyword": "Angenommen ",
            "line": 11,
            "name": "something happened",
            "match": {
              "location": "file:/Users/xxx/someScript.mjs:2:34"
            },
            "result": {
              "status": "skipped",
              "duration": 0
            }
          },
          {
            "keyword": "After",
            "hidden": true,
            "result": {
              "status": "passed",
              "duration": 39500
            }
          },
          {
            "keyword": "After",
            "hidden": true,
            "result": {
              "status": "passed",
              "duration": 622582
            }
          },
          {
            "keyword": "After",
            "hidden": true,
            "result": {
              "status": "passed",
              "duration": 190041
            },
            "embeddings": [
              {
                "data": "Tm90aGluZyB0byBjbGVhbnVw",
                "mime_type": "text/plain"
              }
            ]
          },
          {
            "keyword": "After",
            "hidden": true,
            "result": {
              "status": "passed",
              "duration": 64624
            }
          },
          {
            "keyword": "After",
            "hidden": true,
            "result": {
              "status": "failed",
              "duration": 228791,
              "error_message": "Error: some-error (file:///Users/xxx/someScript.mjs:12:34)\n    at someScript2.mjs (file:///Users/xxx/someScript.mjs:12:34)"
            },
            "embeddings": [
              {
                "data": "",
                "mime_type": "text/plain"
              },
              {
                "data": "",
                "mime_type": "text/plain"
              }
            ]
          }
        ],
        "tags": [
          {
            "name": "@E2E",
            "line": 5
          },
        ],
        "type": "scenario"
      }
    ],
    "id": "some test id",
    "line": 7,
    "keyword": "Funktionalität",
    "name": "TC-WEB-ST-01: some name",
    "tags": [
      {
        "name": "@E2E",
        "line": 5
      }
    ],
    "uri": "features/e2e/some.feature"
  }
]

Expected behavior

The failed Before hook should be present in the report.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions