Tracking type coverage is currently only supported through Pest PHP.
Pest PHP
Pest PHP offers tracking of type coverage through a plug-in. You can see more in our blog post about pest type coverage and the Pest PHP documentation.
Using Pest PHP to track type coverage is incredibly straightforward, and you don't even need to use Pest PHP to run your test suite, to take advantage of type coverage tracking. You must first install the Pest Type Coverage plugin:
1. Install Pest Type Coverage Plugin
composer require pestphp/pest-plugin-type-coverage --dev
2. Add Type Coverage to CI steps
This must be added to your CI workflow file, before the OtterWise script.
- name: Calculate type coverage run: vendor/bin/pest --type-coverage \ --type-coverage-json=pest-type-coverage.json
And that's it! OtterWise will automatically look for a pest-type-coverage.json
file in your project root.
3. (optional) Modify path for type coverage file
If you have choosen another --type-coverage-json value than pest-type-coverage.json, you can adjust it in the OtterWise upload script as well
- name: Upload coverage run: bash <(curl -s https://raw.githubusercontent.com/getOtterWise/bash-uploader/main/uploader.sh) \ --type-coverage-file PATH_TO_FILE_HERE