Description
Currently, when a test case fails or when the contract address in the subgraph.yaml file is incorrect, Matchstick does not provide clear error messages to indicate these issues. This lack of feedback makes it challenging for developers to identify and resolve problems efficiently.
Current Behavior
- When a test fails, there is no detailed error message or stack trace.
- When the contract address in
subgraph.yaml is incorrect, the test seems to run without errors but doesn't execute as expected.
Proposed Improvement
-
For failed tests:
- Provide a clear error message indicating which assertion failed.
- Show a stack trace to help pinpoint the location of the failure.
- Display the expected vs. actual values for failed assertions.
-
For incorrect contract addresses:
- Implement a validation check for contract addresses in
subgraph.yaml
- Provide a clear error message if the contract address is invalid or not found.
- Suggest potential fixes or next steps for the developer.
-
General improvements:
- Implement verbose logging options to allow developers to see more details about the test execution process.
- Add a debug mode that provides step-by-step information about entity creation, updates, and event handling.
Benefits
- Faster debugging and problem-solving for developers.
- Improved developer experience when working with Matchstick and subgraphs.
- Reduced time spent on identifying issues related to configuration or test setup.
Example
Current output for a failed test or incorrect contract address:
Igniting tests 🔥
handletransfer
--------------------------------------------------
Transfer handling:
✨ Done in 3.10s.
Proposed output for a failed test:
Igniting tests 🔥
handletransfer
--------------------------------------------------
Transfer handling:
✘ should handle a transfer and update user balances - FAILED
AssertionError: Expected balance to be 1000, but got -1000
at transfer.test.ts:42:7
Stack trace:
[stack trace information]
Expected: 1000
Actual: -1000
✨ Done in 3.15s.
1 test failed.
Proposed output for an incorrect contract address:
Error: Invalid contract address in subgraph.yaml
The contract address "0x1234...5678" specified in subgraph.yaml could not be found or is invalid.
Please check the following:
1. Ensure the address is correct and properly formatted.
2. Verify that the contract exists on the specified network.
3. Check if the start block is set correctly in subgraph.yaml.
For more information, see: [link to documentation]
Additional Context
This improvement would significantly enhance the developer experience when working with Matchstick, making it easier to identify and resolve issues in subgraph development and testing.
Description
Currently, when a test case fails or when the contract address in the
subgraph.yamlfile is incorrect, Matchstick does not provide clear error messages to indicate these issues. This lack of feedback makes it challenging for developers to identify and resolve problems efficiently.Current Behavior
subgraph.yamlis incorrect, the test seems to run without errors but doesn't execute as expected.Proposed Improvement
For failed tests:
For incorrect contract addresses:
subgraph.yamlGeneral improvements:
Benefits
Example
Current output for a failed test or incorrect contract address:
Proposed output for a failed test:
Proposed output for an incorrect contract address:
Additional Context
This improvement would significantly enhance the developer experience when working with Matchstick, making it easier to identify and resolve issues in subgraph development and testing.