test(command/build): add a test for build command

master
huangjj27 7 years ago
parent 210bf075be
commit 40a5fa2b74
  1. 17
      tests/all/build.rs

@ -20,3 +20,20 @@ fn build_in_non_crate_directory_doesnt_panic() {
let err_msg = result.unwrap_err().to_string();
assert!(err_msg.contains("missing a `Cargo.toml`"));
}
#[test]
fn it_should_build_js_hello_world_example() {
let fixture = utils::fixture::js_hello_world();
let cli = Cli::from_iter_safe(vec![
"wasm-pack",
"build",
&fixture.path.display().to_string(),
])
.unwrap();
let logger = logger::new(&cli.cmd, cli.verbosity).unwrap();
let result = command::run_wasm_pack(cli.cmd, &logger);
assert!(
result.is_ok(),
"running wasm-pack in a js-hello-world directory should succeed.",
);
}

Loading…
Cancel
Save