Skip to content

[Cadence Testing Framework] Pretty Print Error Messages when running tests #3403

Open

Description

Issue to be solved

When running tests with the Cadence testing framework, the errors are spat out as a huge wall of text. It would be great if they were printed in a way that makes them easier to read.

Example:

joshuahannan@Joshuas-MacBook-Pro-2 flow-usdc % flow-c1 test --cover --covercode="contracts" tests/*.cdc
❌ Command Error: Execution failed:
error: assertion failed: given value is: I.Test.Test.Error(message: "[Error Code: 1101] error caused by: 1 error occurred:\n\t* transaction execute failed: [Error Code: 1101] cadence runtime error: Execution failed:\nerror: cannot deploy invalid contract\n --> 751d5fec3fe39dfac9e27973430720b5fcf70588d93503e349d5f4b88f80e0e4:4:16\n  |\n4 |                 signer.contracts.add(name: \"FiatToken\", code: \"696d706f72742043727970746f0a696d706f72742046756e6769626c65546f6b656e2066726f6d203078303030303030303030303030303030320a696d706f72742046756e6769626c65546f6b656e4d6574616461746156696577732066726f6d203078303030303030303030303030303030320a696d706f7274204d6574616461746156696577732066726f6d203078303030303030303030303030303030310a696d706f7274204f6e436861696e4d756c74695369672066726f6d203078303030303030303030303030303030370a696d706f72742049427... \n  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nerror: resource `FiatToken.Admin` does not conform to resource interface `OnChainMultiSig.PublicSigner`\n   --> 0000000000000007.FiatToken:334:22\n    |\n334 | \taccess(all)\tresource Admin: OnChainMultiSig.PublicSigner, ResourceId, AdminCapReceiver { \n    | \t           \t         ^\n   ... \n    |\n391 | \t\taccess(all) fun UUID(): UInt64{ \n    | \t\t                ---- mismatch here\n   ... \n    |\n395 | \t\taccess(all) fun getTxIndex(): UInt64{ \n    | \t\t                ---------- mismatch here\n\n\n")
  --> test_helpers.cdc:26:4

Suggested Solution

Format the output so that the errors are easy to read and understand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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