Skip to content

Cannot read property '__error' of null error thrown when providing null.json to cy.fixture() #8010

@jennifer-shehane

Description

@jennifer-shehane

Current behavior:

When passing a file containing null content to cy.fixture(), an error is thrown: Cannot read property '__error' of null

Desired behavior:

Should read in null.json file as this is valid.

Test code to reproduce

it('works when fx in route', () => {
  cy.visit('https://example.cypress.io/commands/aliasing')
  cy.server()
  cy.route('GET', 'comments/*', 'fx:null.json').as('getComment')
  cy.get('.network-btn').click()
  cy.wait('@getComment').its('status').should('eq', 200)
})

it('works with non-null json', () => {
  cy.fixture("user.json")
})

it('fails with application error', () => {
  cy.fixture("null.json")
})

Versions

4.10.0 (I thought this may have been a regression, but it appears to not be).

Metadata

Metadata

Assignees

No one assigned

    Labels

    pkg/driverThis is due to an issue in the packages/driver directorytype: bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions