MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / write_fake_node

Function write_fake_node

crates/exec-harness/src/runtime_env/node/tests.rs:13–20  ·  view source on GitHub ↗

Fake node: prints `v .0.0` for `--version`, otherwise its argv on one line.

(dir: &Path, major: u32)

Source from the content-addressed store, hash-verified

11
12/// Fake node: prints `v<major>.0.0` for `--version`, otherwise its argv on one line.
13fn write_fake_node(dir: &Path, major: u32) {
14 let script = format!(
15 "#!/usr/bin/env bash\nif [[ \"${{1:-}}\" == --version ]]; then echo v{major}.0.0; else echo \"$@\"; fi\n"
16 );
17 let path = dir.join("node");
18 std::fs::write(&path, script).unwrap();
19 std::fs::set_permissions(&path, std::fs::Permissions::from_mode(EXECUTABLE_MODE)).unwrap();
20}
21
22/// Expected flags, following codspeed-node `getV8Flags()`, plus the perf map
23/// in memory mode.

Callers 1

checkFunction · 0.85

Calls 1

writeFunction · 0.85

Tested by

no test coverage detected