Nile plugin adding coverage reports for Cairo Smart Contracts (from Pytest test suite).
MIT License
Nile plugin adding coverage reports for Cairo Smart Contracts.
Install the plugin inside the virtual environment of your Nile project:
(env): pip install nile-coverage
Nile automatically detects installed plugins using python entry points feature. You should see the coverage command listed running nile
, and you can run the report with:
(env): nile coverage
For a full list of options run:
(env): nile coverage --help
Mark tests with pytest marks and use the --mark
argument to run a subset of tests:
(env): nile coverage -m unit
Generate a cobertura format coverage xml file named "coverage.xml" using the --xml
flag:
(env): nile coverage --xml
If your Smart Contracts are in a different folder than "contracts" (Nile default), use the
--contracts-folder
flag to set the correct one:
(env): nile coverage -c src
This package uses the starknet-edu/cairo-coverage Virtual Machine override to get covered lines for the final report. Special thanks to @LucasLvy from StarkWare!