Skip to content

Customized assersion message not shown when using 'Cypress run' #14484

@iyangdidi

Description

@iyangdidi

Current behavior

I use following code to customize the assersion message
dossierPage.filerPanel.getCapsuleItems(filerName1).should(($lis) => { expect($lis, 'Filter "'+filerName1+'"should have 4 items').to.have.length(5) })
The customized message can be shown when using 'cypress open'
image

But

  1. can't shown when using 'cypress run'
    image
  2. the line number throw the error is not right

Desired behavior

  1. customized message should also be shown when using 'cypress run'
  2. the line number throw the error should be the right line number
    Here is an example of protractor as an reference
    image

Test code to reproduce

  1. any test scripts, add customized message to 'expect',
  2. fail the assersion
  3. run with 'cypress open'
  4. run with 'cypress run'
  5. check the failure information

Versions

"cypress": "^5.5.0",

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions