Skip to content

Conversation

@RAprogramm
Copy link
Owner

Summary

Integrate wasmcov for comprehensive WASM code coverage analysis, resolving the long-standing limitation of measuring coverage only for native-testable code.

Changes

Dependencies

  • Add wasmcov = "0.2" to dev-dependencies for WASM coverage instrumentation

Library Code

  • Implement capture_coverage() FFI function for wasmcov integration (src/lib.rs:35)
  • Function is only exported for wasm32 targets during test builds
  • Proper error handling with console logging for coverage capture failures

CI Infrastructure

  • Add dedicated wasm-coverage job with nightly Rust toolchain
  • Configure wasm32-unknown-unknown target and llvm-tools-preview
  • Install and execute cargo-wasmcov for WASM test coverage
  • Generate LCOV reports and upload to Codecov with wasm flag

Coverage Configuration

  • Configure Codecov flags for separate native and WASM coverage tracking
  • Remove WASM-only modules from ignore list (leptos, yew, api, webapp, logger, pages, router)
  • Enable coverage carryforward for both native and WASM reports

Documentation

Maintenance

  • Add /wasmcov to .gitignore for build artifacts
  • Add wasmcov/** to REUSE.toml for license compliance

Technical Details

wasmcov is a specialized coverage tool developed by Hacken for WebAssembly executables. It:

  • Uses LLVM instrumentation for professional-grade coverage analysis
  • Requires nightly Rust toolchain
  • Runs tests with --test-threads=1 to avoid environment conflicts
  • Generates LCOV-compatible reports for Codecov integration

Testing

All pre-commit checks passed:

  • ✅ Formatting (cargo +nightly fmt)
  • ✅ Linting (cargo clippy)
  • ✅ Tests (197 tests: 26 unit + 4 integration + 167 doctests)
  • ✅ License compliance (reuse lint)

Expected Impact

  • Coverage metrics will now include WASM-only code
  • True project coverage should reach 95%+ target
  • Better visibility into code quality across entire codebase

Closes #130
Closes #128

Add comprehensive WASM code coverage using wasmcov tool.

Changes:
- Add wasmcov v0.2 dependency for WASM coverage analysis
- Implement capture_coverage function for wasmcov integration
- Add dedicated CI job for WASM coverage with nightly toolchain
- Configure Codecov to merge native and WASM coverage reports
- Update README to reflect comprehensive coverage capabilities
- Remove WASM-only modules from codecov ignore list
- Add wasmcov/ directory to .gitignore and REUSE.toml

This resolves the coverage limitations for WASM-only code and enables
accurate coverage metrics for the entire codebase.

Closes #128
@codecov
Copy link

codecov bot commented Oct 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@RAprogramm RAprogramm merged commit 559b4b1 into main Oct 23, 2025
9 checks passed
@RAprogramm RAprogramm deleted the 130 branch October 23, 2025 01:47
@RAprogramm RAprogramm restored the 130 branch October 23, 2025 02:58
@RAprogramm RAprogramm deleted the 130 branch October 29, 2025 01:32
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.

Integrate wasmcov for WASM code coverage WASM code testing and coverage strategy

2 participants