clarinet icon indicating copy to clipboard operation
clarinet copied to clipboard

Coverage report returns empty string after Simnet re-initialization

Open BowTiedRadone opened this issue 11 months ago • 0 comments

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:

  1. Create a new Clarinet project:

    clarinet new demo
    
  2. Add a new contract:

    clarinet contract new hi
    
  3. Replace the content of contracts/hi.clar with:

    (define-public (say-hi)
      (ok true)
    )
    
  4. Create a minimal index.js in 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();
    
  5. Run the code:

    node index.js
    
  6. 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

BowTiedRadone avatar Jan 10 '25 16:01 BowTiedRadone