https://cypress.io logo
#help
Title
# help
p

powerful-gigabyte-69168

05/31/2022, 7:25 PM
Is there any documentation on the logging behavior of
.equal()
? It's really interesting that if you provide a second (string) argument that has a ',' in it, it seems to log the beginning of the string upon success and the entire string upon failure, which makes for some pretty nice reporting:
I've found this really helpful when comparing lists of data against fixtures, so I can have the success case simply output which lists were being compared, but the failure outputs the exact lists:
Copy code
expect(
        cardListsMatch(
          game.players[0].hand,
          fixture.p0Hand
         )
       ).to.eq(
        true,
        `P0 Hand should match fixture, 
          but actual:
          ${printCardList(game.players[0].hand)}
          did not match ficture:
          ${printCardList(fixture.p0Hand)}`
      );
But I fear I'm relying on undocumented and unsupported features that may bite me later 😅
3 Views