Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLT-8605: Code coverage support #8

Merged
merged 1 commit into from
Nov 27, 2023
Merged

Conversation

sjoerdvisscher
Copy link
Collaborator

@sjoerdvisscher sjoerdvisscher commented Nov 21, 2023

Pre-submit checklist:

  • Branch
    • Tests are provided (if possible)
    • Commit sequence broadly makes sense and have useful messages
    • Important changes are reflected in changelog.d of the affected packages
    • Relevant tickets are mentioned in commit messages
  • PR
    • (For external contributions) Corresponding issue exists and is linked in the description
    • Targeting main unless this is a cherry-pick backport
    • Self-reviewed the diff
    • Useful pull request description
    • If relevant, reference the ADR in the PR and reference the PR in the ADR
    • Reviewer requested

Copy link

@brendanrbrown brendanrbrown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the intention to produce the code coverage report HTML when running cabal test?

If so, I needed to add the following lines to cabal.project to allow the coverage report html to be written when running cabal test all.

package *
  coverage: True
  library-coverage: True

cabal test --enable-coverage cardano-node-emulator did not work for me because of this issue, with plutus-ledger-api as the offending library:

haskell/cabal#6440

I did not need to use the workaround in that issue, though. The lines quoted above were enough.

@sjoerdvisscher
Copy link
Collaborator Author

Ah sorry no, the intention is to enable code coverage for plutus scripts.

To try it out do
cabal repl cardano-node-emulator-test
:l Plutus.Examples.EscrowSpec
checkPropEscrowWithCoverage

Which, after a while, outputs an Escrow.html file.

@brendanrbrown brendanrbrown self-requested a review November 22, 2023 14:40
Copy link

@brendanrbrown brendanrbrown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat, thanks.

@sjoerdvisscher sjoerdvisscher merged commit d0206ba into main Nov 27, 2023
3 checks passed
@sjoerdvisscher sjoerdvisscher deleted the plt-8605-code-coverage branch November 27, 2023 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants