File tree 2 files changed +11
-8
lines changed
cli/src/bin/wasm-bindgen-test-runner
2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -31,10 +31,13 @@ pub(crate) fn spawn(
31
31
let cov_dump = r#"
32
32
// Dump the coverage data collected during the tests
33
33
const coverage = __wbgtest_cov_dump();
34
- await fetch("/__wasm_bindgen/coverage", {
35
- method: "POST",
36
- body: coverage
37
- });
34
+
35
+ if (coverage !== undefined) {
36
+ await fetch("/__wasm_bindgen/coverage", {
37
+ method: "POST",
38
+ body: coverage
39
+ });
40
+ }
38
41
"# ;
39
42
40
43
let wbg_import_script = if test_mode. no_modules ( ) {
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use wasm_bindgen::prelude::wasm_bindgen;
2
2
3
3
#[ cfg( wasm_bindgen_unstable_test_coverage) ]
4
4
#[ wasm_bindgen]
5
- pub fn __wbgtest_cov_dump ( ) -> Vec < u8 > {
5
+ pub fn __wbgtest_cov_dump ( ) -> Option < Vec < u8 > > {
6
6
let mut coverage = Vec :: new ( ) ;
7
7
// SAFETY: this function is not thread-safe, but our whole test runner is running single-threaded.
8
8
unsafe {
@@ -14,11 +14,11 @@ pub fn __wbgtest_cov_dump() -> Vec<u8> {
14
14
RUSTFLAGS=\" -Cinstrument-coverage -Zno-profile-runtime --emit=llvm-ir\" " ,
15
15
) ;
16
16
}
17
- coverage
17
+ Some ( coverage)
18
18
}
19
19
20
20
#[ cfg( not( wasm_bindgen_unstable_test_coverage) ) ]
21
21
#[ wasm_bindgen]
22
- pub fn __wbgtest_cov_dump ( ) -> Vec < u8 > {
23
- Vec :: new ( )
22
+ pub fn __wbgtest_cov_dump ( ) -> Option < Vec < u8 > > {
23
+ None
24
24
}
You can’t perform that action at this time.
0 commit comments