From 40a5fa2b741f0e82a0a84d86143245d4e86a50b4 Mon Sep 17 00:00:00 2001 From: huangjj27 <huangjj.27@qq.com> Date: Sat, 13 Oct 2018 13:36:07 +0800 Subject: [PATCH] test(command/build): add a test for build command --- tests/all/build.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/all/build.rs b/tests/all/build.rs index 69a9bab..dee44fd 100644 --- a/tests/all/build.rs +++ b/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.", + ); +}