{"id":23338195,"url":"https://github.com/hknio/wasmcov","last_synced_at":"2025-10-31T17:30:27.060Z","repository":{"id":212556975,"uuid":"716170605","full_name":"hknio/wasmcov","owner":"hknio","description":"Automated coverage analysis of WASM executables on embedded and other constrained environments","archived":false,"fork":false,"pushed_at":"2024-08-13T09:54:11.000Z","size":23690,"stargazers_count":27,"open_issues_count":3,"forks_count":5,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-02-07T05:06:33.055Z","etag":null,"topics":["code-coverage","qaautomation"],"latest_commit_sha":null,"homepage":"https://hknio.github.io/wasmcov/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hknio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-08T15:28:15.000Z","updated_at":"2024-12-17T18:02:56.000Z","dependencies_parsed_at":"2025-01-16T00:12:18.424Z","dependency_job_id":"88d6f86b-4c47-4b86-ac39-5929bc54bdf1","html_url":"https://github.com/hknio/wasmcov","commit_stats":{"total_commits":74,"total_committers":3,"mean_commits":"24.666666666666668","dds":"0.10810810810810811","last_synced_commit":"f75eddf597bf59db739993f8b57a3185862d143b"},"previous_names":["hknio/wasmcov"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hknio%2Fwasmcov","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hknio%2Fwasmcov/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hknio%2Fwasmcov/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hknio%2Fwasmcov/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hknio","download_url":"https://codeload.github.com/hknio/wasmcov/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239217103,"owners_count":19601594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-coverage","qaautomation"],"created_at":"2024-12-21T03:12:41.897Z","updated_at":"2025-10-31T17:30:27.019Z","avatar_url":"https://github.com/hknio.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wasmcov\n\nWasmcov comprises a Rust library and an associated binary that offer a range of utilities for coverage analysis of WebAssembly (Wasm) modules. This tool empowers you to gather and scrutinize code coverage data while executing Wasm modules. Wasmcov stands out for its adaptability and seamless integration into your Wasm projects, serving as a potent instrument to elevate the standard of your Wasm applications.\n\nIf you would like to apply this method to non-Rust WASM binaries, see our [General guide](https://hknio.github.io/wasmcov/docs/General).\n\n## Installation\n\nInstall the `cargo-wasmcov` command by running:\n\n```bash\ncargo install wasmcov\n```\n\n## Usage\n\n`cargo-wasmcov` provides several subcommands to build, run, test, and generate coverage reports for your WASM projects.\n\n### Integrating Coverage Capture\n\nBefore using `cargo-wasmcov`, you need to integrate the coverage capture function into your WebAssembly project:\n\n1. Add `wasmcov` as a dependency in your `Cargo.toml`:\n   ```toml\n   wasmcov = \"0.2\"\n   ```\n\n2. Add the following function to your WebAssembly project:\n\n   ```rust\n   #[cfg(target_family = \"wasm\")]\n   #[no_mangle]\n   pub unsafe extern \"C\" fn capture_coverage() {\n       const BINARY_NAME: \u0026str = env!(\"CARGO_PKG_NAME\");\n       let mut coverage = vec![];\n       wasmcov::minicov::capture_coverage(\u0026mut coverage).unwrap();\n       // Invoke a function to preserve the coverage data or use `println!` for debugging.\n   }\n   ```\n\n   For NEAR Protocol projects, use this macro in `lib.rs` of your smart contract:\n\n   ```rust\n   #[cfg(target_family = \"wasm\")]\n   wasmcov::near::add_coverage!();\n   ```\n\n### Build\n\nBuild your project with WASM coverage instrumentation:\n\n```bash\ncargo wasmcov build [-- \u003cadditional cargo arguments\u003e]\n```\n\nExample:\n```bash\ncargo wasmcov build -- --all --target wasm32-unknown-unknown --release\n```\n\n### Run\n\nRun your project with WASM coverage:\n\n```bash\ncargo wasmcov run [--near \u003cVERSION\u003e] [-- \u003cadditional cargo arguments\u003e]\n```\n\nThe `--near` option allows you to specify a NEAR sandbox version (e.g., 1.35.0) if needed. It is required for near projects.\n\n### Test\n\nRun tests with WASM coverage:\n\n```bash\ncargo wasmcov test [--near \u003cVERSION\u003e] [-- \u003cadditional cargo arguments\u003e]\n```\n\nThe `--near` option allows you to specify a NEAR sandbox version (e.g., 1.35.0) if needed. It is required for near projects.\n\n### Generate Coverage Report\n\nGenerate a coverage report:\n\n```bash\ncargo wasmcov report [-- \u003cadditional llvm-cov arguments\u003e]\n```\n\nThis command will process all collected coverage data and generate reports for each target.\n\n### Clean\n\nClean coverage data:\n\n```bash\ncargo wasmcov clean [--all]\n```\n\nUse the `--all` flag to remove the entire wasmcov directory content.\n\n## Notes\n\n- The tool uses the nightly Rust toolchain for building and running.\n- Coverage reports are generated using LLVM coverage tools.\n- For NEAR-specific projects, you must specify the NEAR sandbox version using the `--near` option with the `run` and `test` subcommands.\n\n## License\n\nThis repository is distributed under the terms of the Apache License (Version 2.0). Refer to [LICENSE](LICENSE) for details.\n\nWhen using the Wasmcov workaround (llvm-ir to .o file for linking) on its own, an attribution is required.\n\n## Maintainer\n\nThis repository is currently managed by [Bartosz Barwikowski](https://www.linkedin.com/in/bbarwik/) from [Hacken](https://hacken.io/). It was originally created by [Noah Jelich](https://www.linkedin.com/in/njelich/), while the method itself was co-created with Bartosz. Please don't hesitate to reach out for any queries or concerns.\n\n## Contributing\n\nContributions are encouraged! Employ the `cargo build` command to build the project. Note: during testing, deactivate parallelism by using the `--test-threads=1` flag. This ensures environment variables remain unaffected by other tests.\n\nFor convenience, utilize the shorthands `make build` and `make test` for building and testing the project, respectively.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhknio%2Fwasmcov","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhknio%2Fwasmcov","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhknio%2Fwasmcov/lists"}