LimeChain / matchstick

šŸ”„ Unit testing framework for Subgraph development on The Graph protocol. āš™ļø
MIT License
207 stars 17 forks source link

Unmocked function call does not provide information on the test case that caused it #371

Closed 0xJem closed 2 years ago

0xJem commented 2 years ago

Running matchstick-as 0.5.0, if there is a call that has not been mocked, the CLI output does not provide any information/context on which test case (ideally, which line in the source code!) caused it. All that is output is:

thread 'main' panicked at 'šŸ†˜ Could not find a mocked function for function with address: 0xbd0dā€¦5660, name: lp_token, signature lp_token():(address), params: [].', src/context.rs:849:13

It would be far more helpful if that context was given. Thanks!

dimitrovmaksim commented 2 years ago

Hey, unfortunately after the tests are compiled to wasm, all the information about the lines, etc are lost and can't be traced. I will look into if it's possible to provide the test case name or just fail that test and not crash matchstick

dimitrovmaksim commented 2 years ago

matchstick 0.5.3 now should fail the tests that call a function which has not been mocked and display the failed tests at the bottom of the log

0xJem commented 2 years ago

Hey, unfortunately after the tests are compiled to wasm, all the information about the lines, etc are lost and can't be traced. I will look into if it's possible to provide the test case name or just fail that test and not crash matchstick

That's a shame! Thanks for the quick reply. I think the changes in 0.5.3 should at least help with tracking down the offending code.