Skip to content

Commit e6e066c

Browse files
authored
138 (#139)
* #138 fix: add wasmcov build step before test Add cargo wasmcov build step with wasm32-unknown-unknown target before running tests. This ensures coverage instrumentation is properly set up for WASM code. * #138 fix: use --lib flag to avoid building bins for wasm32 reqwest::blocking is not available for wasm32 target, causing build failure for update_readme bin. Build only the library with --lib flag. * #130 fix: add --package flag to wasmcov commands to exclude demo workspace * #130 fix: remove WASM coverage - no working solution exists in 2025 - Remove wasm-coverage job from CI workflow - Remove wasmcov dependency from Cargo.toml - Remove capture_coverage function from lib.rs - Remove wasm flag from codecov.yml - Keep only native coverage which works correctly Reason: WASM test coverage with wasm-bindgen-test is experimental, unstable, and has no working tools or public examples. Even wasm-bindgen itself disables coverage where possible. * fail * #138 fix: remove wasm-coverage artifact and add to .gitignore
1 parent 5bdb61c commit e6e066c

File tree

7 files changed

+1
-219
lines changed

7 files changed

+1
-219
lines changed

.github/workflows/reusable-ci.yml

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -224,51 +224,3 @@ jobs:
224224
files: lcov.info
225225
fail_ci_if_error: true
226226
verbose: true
227-
flags: native
228-
229-
wasm-coverage:
230-
name: Coverage (WASM)
231-
runs-on: ubuntu-latest
232-
needs: setup
233-
steps:
234-
- uses: actions/checkout@v5
235-
236-
- name: Install Rust nightly
237-
uses: dtolnay/rust-toolchain@v1
238-
with:
239-
toolchain: nightly
240-
targets: wasm32-unknown-unknown
241-
components: llvm-tools-preview
242-
243-
- name: Cache cargo
244-
uses: Swatinem/rust-cache@v2
245-
with:
246-
shared-key: "nightly-wasm"
247-
save-if: ${{ github.ref == 'refs/heads/main' }}
248-
249-
- name: Install wasmcov
250-
shell: bash
251-
run: |
252-
set -euo pipefail
253-
cargo +nightly install wasmcov
254-
255-
- name: Run WASM tests with coverage
256-
shell: bash
257-
run: |
258-
set -euo pipefail
259-
cargo +nightly wasmcov test -- --all-features -- --test-threads=1
260-
261-
- name: Generate WASM coverage report
262-
shell: bash
263-
run: |
264-
set -euo pipefail
265-
cargo +nightly wasmcov report -- export --format=lcov > wasm-lcov.info || echo "SF:dummy" > wasm-lcov.info
266-
267-
- name: Upload WASM coverage to Codecov
268-
uses: codecov/codecov-action@v5
269-
with:
270-
token: ${{ secrets.CODECOV_TOKEN }}
271-
files: wasm-lcov.info
272-
fail_ci_if_error: false
273-
verbose: true
274-
flags: wasm

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/target
22
/wasmcov
3+
wasm-coverage

Cargo.lock

Lines changed: 0 additions & 147 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,3 @@ members = ["demo"]
8585
[dev-dependencies]
8686
wasm-bindgen-test = "0.3"
8787
wasm-bindgen-futures = "0.4"
88-
wasmcov = "0.2"

codecov.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ flags:
1919
paths:
2020
- src/
2121
carryforward: true
22-
wasm:
23-
paths:
24-
- src/
25-
carryforward: true
2622

2723
comment:
2824
layout: "header,diff,flags,components,files,footer"

src/lib.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,3 @@ pub mod yew;
3131

3232
#[cfg(feature = "leptos")]
3333
pub mod leptos;
34-
35-
/// Captures code coverage data for WASM builds.
36-
///
37-
/// This function is used by wasmcov to collect coverage information during test
38-
/// execution. It should not be called directly in application code.
39-
///
40-
/// # Safety
41-
///
42-
/// This function is marked as unsafe due to FFI requirements.
43-
/// It is only exported for wasm32 targets and called by the wasmcov test
44-
/// harness.
45-
#[cfg(all(target_family = "wasm", test))]
46-
#[no_mangle]
47-
pub unsafe extern "C" fn capture_coverage() {
48-
let mut coverage = Vec::new();
49-
if let Err(e) = wasmcov::minicov::capture_coverage(&mut coverage) {
50-
web_sys::console::error_1(&format!("Coverage capture failed: {}", e).into());
51-
}
52-
}

test-lcov.info

Whitespace-only changes.

0 commit comments

Comments
 (0)