Skip to content

Commit

Permalink
add profraw prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
aDogCalledSpot committed Jan 18, 2024
1 parent 85c93f0 commit 88d5b68
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions crates/cli/src/bin/wasm-bindgen-test-runner/main.rs
Expand Up @@ -248,26 +248,32 @@ fn main() -> anyhow::Result<()> {
}

fn coverage_args(tmpdir: &Path) -> Option<PathBuf> {
fn generated(tmpdir: &Path) -> String {
format!(
"{}.profraw",
fn generated(tmpdir: &Path, prefix: &str) -> String {
let res = format!(
"{prefix}{}.profraw",
tmpdir.file_name().and_then(|s| s.to_str()).unwrap()
)
);
res
}

// Profraw path is ignored if coverage isn't enabled
env::var_os("WASM_BINDGEN_UNSTABLE_TEST_COVERAGE")?;
// TODO coverage link to wasm-bindgen book documenting correct usage

let prefix = env::var_os("WASM_BINDGEN_UNSTABLE_TEST_PROFRAW_PREFIX")
.map(|s| s.to_str().unwrap().to_string())
.unwrap_or_default();


match env::var_os("WASM_BINDGEN_UNSTABLE_TEST_PROFRAW_OUT") {
Some(s) => {
let mut buf = PathBuf::from(s);
if buf.is_dir() {
buf.push(generated(tmpdir));
buf.push(generated(tmpdir, &prefix));
}
buf
}
None => PathBuf::from(generated(tmpdir)),
None => PathBuf::from(generated(tmpdir, &prefix)),
}
.into()
}

0 comments on commit 88d5b68

Please sign in to comment.