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

Coverage report returns empty string after Simnet re-initialization #1638

Open
BowTiedRadone opened this issue Jan 10, 2025 · 0 comments
Open

Comments

@BowTiedRadone
Copy link

BowTiedRadone commented Jan 10, 2025

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant