Shelex / cypress-allure-plugin

cypress plugin to use allure reporter api in tests

Home Page:https://shelex.github.io/cypress-allure-plugin-example/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failure in nested before hook makes root-level test disappear from report

JessefSpecialisterren opened this issue · comments

To Reproduce
Run this spec with allure reporting enabled:

it('root-level test', () => {
  cy.log('root-level test')
})

context('somecontext', () => {
  before(() => {
    cy.log('nested before hook')
    throw new Error('failure in a nested before hook')
  })

  it('nested test', () => {
    cy.log('nested test')
  })
})

Note how the resulting report only contains nested test, but that test contains the log step of root-level test (?) as well as the error message from the before hook. Commenting the throw line results in a report that correctly contains both tests

Expected behavior
I would expect to find root-level test in the report marked Passed, and nested test marked Broken/Defect

Environment (please complete the following information):

  • Cypress version: 12.14.0
  • OS: Windows 10
  • cypress-allure-plugin version: 2.40.0
  • allure2 version: 2.19.0

I think the problem here is caused by test which is not attached to any suite and works just because cypress wraps everything in some "global" suite per file, however due to possible edge-cases I am not sure a proper solution could be found for such "hanging" tests without parent suite.