LimeChain / matchstick

🔥 Unit testing framework for Subgraph development on The Graph protocol. ⚙️
MIT License
210 stars 18 forks source link

Coverage flag not working #274

Closed ghardin1314 closed 2 years ago

ghardin1314 commented 2 years ago

The coverage flag update in 0.2.3 does not seem to be working. I get the following error when using -c

image

This is the same if I try to run naively on Linux or in a dockerfile similar to the subgraph-demo setup

config:

"@graphprotocol/graph-cli": "0.25.1",
"@graphprotocol/graph-ts": "0.24.1",
"matchstick-as": "0.2.3",
dimitrovmaksim commented 2 years ago

Check the instructions on how to use it https://github.com/LimeChain/demo-subgraph#test-coverage-linux-and-macos

If that does not work, could you send me a screenshot of your test file or a link to the repo? Could you try deleting node_modules and package-lock.json, then run npm install again.

ghardin1314 commented 2 years ago

Followed the instructions with a fresh install and still getting the same error. Here is one of our test files located at ./tests/subgraph/GnosisSafeL2.test.ts

https://gist.github.com/ghardin1314/3b01adf26361ff21c674e786d221f37f

dimitrovmaksim commented 2 years ago

--Edit-- I think I managed to reproduce it, will look into it.

dimitrovmaksim commented 2 years ago

So, currently there is a small limitation, in order for the coverage to work, your test suite name should match the mapping file name for the specific datasource, for example in the demo-subgraph, the mappings file name is gravity.ts, and the tests are located in './tests/gravity', which creates a test suite named gravity.

ghardin1314 commented 2 years ago

Ah, so because our files are named .mapping.ts this is causing the issue?

Does folder structure also matter? Until #275 is closed we have to use one test suite called subgraph to separate our mapping tests from our contracts tests

dimitrovmaksim commented 2 years ago

Could you try running the coverage with version 0.2.4-alpha and tell me if it works?