You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[cfg(target_os = "windows")]
#[test]
fn it_format_out_dir_on_windows() {
let fixture = utils::fixture::js_hello_world();
fixture.install_local_wasm_bindgen();
let cli = Cli::from_iter_safe(vec![
"wasm-pack",
"build",
&fixture.path.display().to_string(),
])
.unwrap();
let logger = logger::new(&cli.cmd, 3).unwrap();
let result =
command::run_wasm_pack(cli.cmd, &logger).expect("js_hello_world example should pass");
let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap();
assert!(
wasm_pack_log.contains(r"Your wasm pkg is ready to publish at \\?\C:\Users\"),
"directories in wasm-pack.log should be well formatted",
);
}
the test generate a temp project directory c:\Users\34937\Documents\wasm-pack\target\t\.tmpfrYWhr\wasm-pack, let's call it the tmp_wasm_pack.
But, In the wasm-pack.log generated at the tmp_wasm_pack, it complains that a wasm file is not found:
error: failed to read `target/wasm32-unknown-unknown/release/js_hello_world.wasm`
caused by: 系统找不到指定的路径。 (os error 3) # system can't find the path
What I discover, is that in order to reuse artifacts, the $CARGO_TARGET_DIR of tmp_wasm_pack is set to the same target directory as wasm-pack's, declared at:
// tests/utils/fixture.rs line 28-48
impl Fixture {
/// Create a new test fixture in a temporary directory.
pub fn new() -> Fixture {
// Make sure that all fixtures end up sharing a target dir, and we don't
// recompile wasm-bindgen and friends many times over.
static SET_TARGET_DIR: Once = ONCE_INIT;
let target_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("target");
SET_TARGET_DIR.call_once(|| {
env::set_var("CARGO_TARGET_DIR", &target_dir);
});
let root = target_dir.join("t");
fs::create_dir_all(&root).unwrap();
let dir = TempDir::new_in(&root).unwrap();
let path = dir.path().join("wasm-pack");
eprintln!("Created fixture at {}", path.display());
Fixture {
dir: ManuallyDrop::new(dir),
path,
}
}
// omitting...
}
I believe it's the reset of $CARGO_TARGET_DIR that causes the problem when running wasm-bindgen in wasm-pack, and I wonder if wasm-bindgen searches output artifacts based on $CARGO_TARGET_DIR. If so, wasm-bindgen should find out these artifacts lay in `wasm-pack/target/wasm32-unknown-unknown
The text was updated successfully, but these errors were encountered:
Currently wasm-bindgen doesn't do any searching around, it only uses the path that's passed in. The wasm-bindgen-test-runner does do some inference based on the input path, but it also doesn't do any searching. I think this may be a bug in the test perhaps?
In the past week, I was trying to fix rustwasm/wasm-pack#390. Then, I write a test case as follow:
the test generate a temp project directory
c:\Users\34937\Documents\wasm-pack\target\t\.tmpfrYWhr\wasm-pack
, let's call it thetmp_wasm_pack
.But, In the wasm-pack.log generated at the
tmp_wasm_pack
, it complains that a wasm file is not found:What I discover, is that in order to reuse artifacts, the $CARGO_TARGET_DIR of
tmp_wasm_pack
is set to the same target directory as wasm-pack's, declared at:I believe it's the reset of $CARGO_TARGET_DIR that causes the problem when running wasm-bindgen in wasm-pack, and I wonder if wasm-bindgen searches output artifacts based on $CARGO_TARGET_DIR. If so, wasm-bindgen should find out these artifacts lay in `wasm-pack/target/wasm32-unknown-unknown
The text was updated successfully, but these errors were encountered: