clarinet
clarinet copied to clipboard
Coverage report returns empty string after Simnet re-initialization
Describe the Bug
When trying to get a coverage report on a Simnet session that was re-initialized using initEmptySession, the report returns an empty string. While Simnet sessions can be re-initialized, this issue occurs specifically when retrieving the coverage report after re-initialization.
To Reproduce Steps to reproduce the issue:
-
Create a new Clarinet project:
clarinet new demo -
Add a new contract:
clarinet contract new hi -
Replace the content of
contracts/hi.clarwith:(define-public (say-hi) (ok true) ) -
Create a minimal
index.jsin the project with this code:import { initSimnet } from "@hirosystems/clarinet-sdk"; const main = async () => { const simnet = await initSimnet("Clarinet.toml", false, { trackCosts: false, trackCoverage: true, }); await simnet.initEmptySession(); simnet.setEpoch("2.5"); simnet.deployContract( "hi", `(define-public (say-hello) (ok true))`, { clarityVersion: 2 }, simnet.deployer ); simnet.callPublicFn( `${simnet.deployer}.hi`, "say-hello", [], simnet.deployer ); const report = simnet.collectReport(false, ""); console.log("coverage:", report.coverage); }; await main(); -
Run the code:
node index.js -
Check the output:
coverage: // empty string
Expected Behavior
The coverage report should contain data for the updated contract source instead of being empty.
Environment
- OS: macOS 14.6.1
- Clarinet version: 2.12.0