From c98287ff1681a9ae4517d3c8b49eb9153a8c4806 Mon Sep 17 00:00:00 2001 From: Junjie Huang <349373001@qq.com> Date: Fri, 5 Oct 2018 23:53:20 +0800 Subject: [PATCH 01/17] bugfix(command/build.rs): Cancel Escape fix #390 --- src/command/build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/command/build.rs b/src/command/build.rs index d3dc15f..9abd8e3 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -176,13 +176,13 @@ impl Build { info!(&log, "Done in {}.", &duration); info!( &log, - "Your wasm pkg is ready to publish at {:#?}.", &self.out_dir + "Your wasm pkg is ready to publish at {:#}.", &self.out_dir ); PBAR.message(&format!("{} Done in {}", emoji::SPARKLE, &duration)); PBAR.message(&format!( - "{} Your wasm pkg is ready to publish at {:#?}.", + "{} Your wasm pkg is ready to publish at {:#}.", emoji::PACKAGE, self.out_dir.canonicalize().unwrap_or(self.out_dir.clone()) )); From d6aea784af38048e6116edc9aa2df073f271aaf7 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 6 Oct 2018 13:36:28 +0800 Subject: [PATCH 02/17] Update src/command/build.rs use Path::display to show out_dir --- src/command/build.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/command/build.rs b/src/command/build.rs index 9abd8e3..8adc928 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -176,15 +176,15 @@ impl Build { info!(&log, "Done in {}.", &duration); info!( &log, - "Your wasm pkg is ready to publish at {:#}.", &self.out_dir + "Your wasm pkg is ready to publish at {}.", self.out_dir.display() ); PBAR.message(&format!("{} Done in {}", emoji::SPARKLE, &duration)); PBAR.message(&format!( - "{} Your wasm pkg is ready to publish at {:#}.", + "{} Your wasm pkg is ready to publish at {}.", emoji::PACKAGE, - self.out_dir.canonicalize().unwrap_or(self.out_dir.clone()) + self.out_dir.canonicalize().unwrap_or(self.out_dir.clone()).display() )); Ok(()) } From 6c54d293f591fe336f3aeb83a0d2842a6da0cb52 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 6 Oct 2018 13:54:04 +0800 Subject: [PATCH 03/17] fmt(command/build.rs): format code changes --- src/command/build.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/command/build.rs b/src/command/build.rs index 8adc928..c7d7efc 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -176,7 +176,8 @@ impl Build { info!(&log, "Done in {}.", &duration); info!( &log, - "Your wasm pkg is ready to publish at {}.", self.out_dir.display() + "Your wasm pkg is ready to publish at {}.", + self.out_dir.display() ); PBAR.message(&format!("{} Done in {}", emoji::SPARKLE, &duration)); @@ -184,7 +185,10 @@ impl Build { PBAR.message(&format!( "{} Your wasm pkg is ready to publish at {}.", emoji::PACKAGE, - self.out_dir.canonicalize().unwrap_or(self.out_dir.clone()).display() + self.out_dir + .canonicalize() + .unwrap_or(self.out_dir.clone()) + .display() )); Ok(()) } From 6edb3732aa87986b88ea3c7d6052c728e2894978 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Mon, 8 Oct 2018 21:31:27 +0800 Subject: [PATCH 04/17] update(command/build): lazily eval if canonicalizing failed --- src/command/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command/build.rs b/src/command/build.rs index c7d7efc..63a963a 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -187,7 +187,7 @@ impl Build { emoji::PACKAGE, self.out_dir .canonicalize() - .unwrap_or(self.out_dir.clone()) + .unwrap_or_else(|_err| self.out_dir.clone()) .display() )); Ok(()) From 472890c063a83cc5cbf3c7fd4c25dda76afb2fe5 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Thu, 11 Oct 2018 22:12:56 +0800 Subject: [PATCH 05/17] test(command/build): add test for fix-390 --- tests/all/build.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/all/build.rs b/tests/all/build.rs index cc21fbb..29b0fb5 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -227,4 +227,22 @@ fn build_with_and_without_wasm_bindgen_debug() { "Should only contain moved value assertions when debug assertions are enabled" ); } +#[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(), + ]) + let result = command::run_wasm_pack(cli.cmd, &logger); + assert!(result.is_ok(), "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", + ); } From 054e1739ae69c003fcb6db8da27c4181b2d2e195 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 13 Oct 2018 22:42:07 +0800 Subject: [PATCH 06/17] test(command/build): right test case the test case would pass after solving #408 --- tests/all/build.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/all/build.rs b/tests/all/build.rs index 29b0fb5..18028d3 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -237,8 +237,9 @@ fn it_format_out_dir_on_windows() { "build", &fixture.path.display().to_string(), ]) - let result = command::run_wasm_pack(cli.cmd, &logger); - assert!(result.is_ok(), "js_hello_world example should pass"); + let logger = logger::new(&cli.cmd, 1).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!( From cf56fa10d68c2e4b03a04913ae6f571bc53c6571 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Tue, 16 Oct 2018 22:42:46 +0800 Subject: [PATCH 07/17] bugfix(command/build): passing test case this commit fixes #390, #414, and closes #408 for the test case have to pass after a successful build. --- src/bindgen.rs | 4 ++++ tests/all/build.rs | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/bindgen.rs b/src/bindgen.rs index 8282f6b..512eb51 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -8,7 +8,11 @@ use failure::{self, ResultExt}; use manifest::CrateData; use progressbar::Step; use slog::Logger; +<<<<<<< HEAD use std::fs; +======= +use std::env; +>>>>>>> bugfix(command/build): passing test case use std::path::{Path, PathBuf}; use std::process::Command; use target; diff --git a/tests/all/build.rs b/tests/all/build.rs index 18028d3..9a42ed9 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -34,6 +34,7 @@ fn it_should_build_js_hello_world_example() { &fixture.path.display().to_string(), ]) .unwrap(); +<<<<<<< HEAD fixture.run(cli.cmd).unwrap(); } @@ -138,6 +139,11 @@ fn it_should_build_nested_project_with_transitive_dependencies() { ]) .unwrap(); fixture.run(cli.cmd).unwrap(); +======= + let logger = logger::new(&cli.cmd, cli.verbosity).unwrap(); + command::run_wasm_pack(cli.cmd, &logger) + .expect("running wasm-pack in a js-hello-world directory should succeed."); +>>>>>>> bugfix(command/build): passing test case } #[test] @@ -237,9 +243,15 @@ fn it_format_out_dir_on_windows() { "build", &fixture.path.display().to_string(), ]) +<<<<<<< HEAD let logger = logger::new(&cli.cmd, 1).unwrap(); let _result = command::run_wasm_pack(cli.cmd, &logger).expect("js_hello_world example should pass"); +======= + .unwrap(); + let result = command::run_wasm_pack(cli.cmd, &logger); + assert!(result.is_ok(), "js_hello_world example should pass"); +>>>>>>> bugfix(command/build): passing test case let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); assert!( From b3010155886d38f6a8be10c22b525fc4bd5da9ee Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 20 Oct 2018 23:42:22 +0800 Subject: [PATCH 08/17] update: rebasing to master fixes conflicts encountered when rebasing to master fixes # 390 --- src/bindgen.rs | 3 --- tests/all/build.rs | 12 ------------ 2 files changed, 15 deletions(-) diff --git a/src/bindgen.rs b/src/bindgen.rs index 512eb51..32f7063 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -8,11 +8,8 @@ use failure::{self, ResultExt}; use manifest::CrateData; use progressbar::Step; use slog::Logger; -<<<<<<< HEAD use std::fs; -======= use std::env; ->>>>>>> bugfix(command/build): passing test case use std::path::{Path, PathBuf}; use std::process::Command; use target; diff --git a/tests/all/build.rs b/tests/all/build.rs index 9a42ed9..18028d3 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -34,7 +34,6 @@ fn it_should_build_js_hello_world_example() { &fixture.path.display().to_string(), ]) .unwrap(); -<<<<<<< HEAD fixture.run(cli.cmd).unwrap(); } @@ -139,11 +138,6 @@ fn it_should_build_nested_project_with_transitive_dependencies() { ]) .unwrap(); fixture.run(cli.cmd).unwrap(); -======= - let logger = logger::new(&cli.cmd, cli.verbosity).unwrap(); - command::run_wasm_pack(cli.cmd, &logger) - .expect("running wasm-pack in a js-hello-world directory should succeed."); ->>>>>>> bugfix(command/build): passing test case } #[test] @@ -243,15 +237,9 @@ fn it_format_out_dir_on_windows() { "build", &fixture.path.display().to_string(), ]) -<<<<<<< HEAD let logger = logger::new(&cli.cmd, 1).unwrap(); let _result = command::run_wasm_pack(cli.cmd, &logger).expect("js_hello_world example should pass"); -======= - .unwrap(); - let result = command::run_wasm_pack(cli.cmd, &logger); - assert!(result.is_ok(), "js_hello_world example should pass"); ->>>>>>> bugfix(command/build): passing test case let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); assert!( From 6d3f1c283556274b32875b64d421691c58058a82 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Wed, 7 Nov 2018 20:46:45 +0800 Subject: [PATCH 09/17] remove canonicalize and use display directly --- src/command/build.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/command/build.rs b/src/command/build.rs index 63a963a..37ec93d 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -185,10 +185,7 @@ impl Build { PBAR.message(&format!( "{} Your wasm pkg is ready to publish at {}.", emoji::PACKAGE, - self.out_dir - .canonicalize() - .unwrap_or_else(|_err| self.out_dir.clone()) - .display() + self.out_dir.display() )); Ok(()) } From 2512199cb3f79c70620ab069b3702decc034adbd Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Thu, 8 Nov 2018 21:33:31 +0800 Subject: [PATCH 10/17] resolve conlicts and pass the test --- src/bindgen.rs | 1 - tests/all/build.rs | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/bindgen.rs b/src/bindgen.rs index 32f7063..8282f6b 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -9,7 +9,6 @@ use manifest::CrateData; use progressbar::Step; use slog::Logger; use std::fs; -use std::env; use std::path::{Path, PathBuf}; use std::process::Command; use target; diff --git a/tests/all/build.rs b/tests/all/build.rs index 18028d3..3cef420 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -237,13 +237,12 @@ fn it_format_out_dir_on_windows() { "build", &fixture.path.display().to_string(), ]) - let logger = logger::new(&cli.cmd, 1).unwrap(); - let _result = - command::run_wasm_pack(cli.cmd, &logger).expect("js_hello_world example should pass"); + .unwrap(); + fixture.run(cli.cmd).unwrap(); 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\"), + wasm_pack_log.contains(r"Your wasm pkg is ready to publish at c:\Users\"), "directories in wasm-pack.log should be well formatted", ); } From 83de8d71d22892e8417728b6dbce312a969a2349 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Thu, 8 Nov 2018 22:55:58 +0800 Subject: [PATCH 11/17] fix test for wasm-bindgen 0.2.21 --- tests/all/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/all/build.rs b/tests/all/build.rs index 3cef420..72d0701 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -242,7 +242,7 @@ fn it_format_out_dir_on_windows() { 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\"), + wasm_pack_log.contains(r"Your wasm pkg is ready to publish at C:\Users\"), "directories in wasm-pack.log should be well formatted", ); } From 06e38ec3e8bc27824f4563d5a004999580ad3f4f Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 10 Nov 2018 10:47:17 +0800 Subject: [PATCH 12/17] checkout if CI's log contain INFO messages --- tests/all/build.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/all/build.rs b/tests/all/build.rs index 72d0701..b0f8ccc 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -241,6 +241,12 @@ fn it_format_out_dir_on_windows() { fixture.run(cli.cmd).unwrap(); let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); + + // may be the CI doesn't output INFO content + assert!( + wasm_pack_log.contains("INFO"), + "wasm_pack.log should output INFO level message", + ); 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", From 7fd731279b4ca97e1cfa801c884157e8cb3c7e62 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 10 Nov 2018 11:04:43 +0800 Subject: [PATCH 13/17] print out wasm-log for check --- tests/all/build.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tests/all/build.rs b/tests/all/build.rs index b0f8ccc..7e61e6c 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -241,14 +241,8 @@ fn it_format_out_dir_on_windows() { fixture.run(cli.cmd).unwrap(); let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); - - // may be the CI doesn't output INFO content assert!( - wasm_pack_log.contains("INFO"), - "wasm_pack.log should output INFO level message", - ); - assert!( - wasm_pack_log.contains(r"Your wasm pkg is ready to publish at C:\Users\"), + wasm_pack_log.contains(r"Your wasm pkg is ready to publish at \\?\C:\Users\"), "directories in wasm-pack.log should be well formatted", ); } From 837393b5fcec35822538b02d060de2d2d3a7e531 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 17 Nov 2018 00:27:55 +0800 Subject: [PATCH 14/17] trim head --- tests/all/build.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/all/build.rs b/tests/all/build.rs index 7e61e6c..d40d345 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -227,6 +227,8 @@ fn build_with_and_without_wasm_bindgen_debug() { "Should only contain moved value assertions when debug assertions are enabled" ); } +} + #[cfg(target_os = "windows")] #[test] fn it_format_out_dir_on_windows() { @@ -242,7 +244,7 @@ fn it_format_out_dir_on_windows() { 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\"), + wasm_pack_log.contains(r"Your wasm pkg is ready to publish at c:\Users\"), "directories in wasm-pack.log should be well formatted", ); } From 06a949b9ed314d1e3ad0400b6b4446cb9817d03c Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 17 Nov 2018 12:22:37 +0800 Subject: [PATCH 15/17] Capital disk Url --- tests/all/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/all/build.rs b/tests/all/build.rs index d40d345..0c91d06 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -244,7 +244,7 @@ fn it_format_out_dir_on_windows() { 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\"), + wasm_pack_log.contains(r"Your wasm pkg is ready to publish at C:\Users\"), "directories in wasm-pack.log should be well formatted", ); } From 9feb3a857cbbe8df1b3c743e45eae930a8c568e7 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 17 Nov 2018 23:57:48 +0800 Subject: [PATCH 16/17] check if the log missing things --- tests/all/build.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/all/build.rs b/tests/all/build.rs index 0c91d06..95d86c0 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -243,6 +243,14 @@ fn it_format_out_dir_on_windows() { fixture.run(cli.cmd).unwrap(); let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); + assert!( + wasm_pack_log.contains("INFO"), + "wasm-pack.log should contains INFO message" + ); + assert!( + wasm_pack_log.contains("Your wasm pkg is ready to publish at"), + "wasm-pack.log should contains publish message" + ); 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", From c6894c46f7bc392b116e7dbc1668dcc3aa849241 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sun, 18 Nov 2018 00:13:40 +0800 Subject: [PATCH 17/17] bugfix(390): pass the ci in the CI, there is no user. begining with "C:\" is just enough --- tests/all/build.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/tests/all/build.rs b/tests/all/build.rs index 95d86c0..7d06f15 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -244,15 +244,7 @@ fn it_format_out_dir_on_windows() { let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); assert!( - wasm_pack_log.contains("INFO"), - "wasm-pack.log should contains INFO message" - ); - assert!( - wasm_pack_log.contains("Your wasm pkg is ready to publish at"), - "wasm-pack.log should contains publish message" - ); - assert!( - wasm_pack_log.contains(r"Your wasm pkg is ready to publish at C:\Users\"), + wasm_pack_log.contains(r"Your wasm pkg is ready to publish at C:\"), "directories in wasm-pack.log should be well formatted", ); }