|
|
|
@ -65,11 +65,10 @@ fn it_creates_a_package_json_default_path() { |
|
|
|
|
assert_eq!(types, "wasm_pack.d.ts"); |
|
|
|
|
|
|
|
|
|
let actual_files: HashSet<String> = pkg.files.into_iter().collect(); |
|
|
|
|
let expected_files: HashSet<String> = |
|
|
|
|
["wasm_pack_bg.wasm", "wasm_pack.d.ts"] |
|
|
|
|
.iter() |
|
|
|
|
.map(|&s| String::from(s)) |
|
|
|
|
.collect(); |
|
|
|
|
let expected_files: HashSet<String> = ["wasm_pack_bg.wasm", "wasm_pack.d.ts"] |
|
|
|
|
.iter() |
|
|
|
|
.map(|&s| String::from(s)) |
|
|
|
|
.collect(); |
|
|
|
|
assert_eq!(actual_files, expected_files); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -78,7 +77,7 @@ fn it_creates_a_package_json_provided_path() { |
|
|
|
|
let step = wasm_pack::progressbar::Step::new(1); |
|
|
|
|
let path = "tests/fixtures/js-hello-world".to_string(); |
|
|
|
|
wasm_pack::command::init::create_pkg_dir(&path, &step).unwrap(); |
|
|
|
|
assert!(manifest::write_package_json(&path, &None, false, "", &step).is_ok()); |
|
|
|
|
assert!(manifest::write_package_json(&path, &None, false, "", &step).is_ok()); |
|
|
|
|
let package_json_path = format!("{}/pkg/package.json", &path); |
|
|
|
|
assert!(fs::metadata(package_json_path).is_ok()); |
|
|
|
|
assert!(utils::read_package_json(&path).is_ok()); |
|
|
|
@ -87,10 +86,8 @@ fn it_creates_a_package_json_provided_path() { |
|
|
|
|
assert_eq!(pkg.main, "js_hello_world.js"); |
|
|
|
|
|
|
|
|
|
let actual_files: HashSet<String> = pkg.files.into_iter().collect(); |
|
|
|
|
let expected_files: HashSet<String> = [ |
|
|
|
|
"js_hello_world_bg.wasm", |
|
|
|
|
"js_hello_world.d.ts", |
|
|
|
|
].iter() |
|
|
|
|
let expected_files: HashSet<String> = ["js_hello_world_bg.wasm", "js_hello_world.d.ts"] |
|
|
|
|
.iter() |
|
|
|
|
.map(|&s| String::from(s)) |
|
|
|
|
.collect(); |
|
|
|
|
assert_eq!(actual_files, expected_files); |
|
|
|
@ -101,7 +98,9 @@ fn it_creates_a_package_json_provided_path_with_scope() { |
|
|
|
|
let step = wasm_pack::progressbar::Step::new(1); |
|
|
|
|
let path = "tests/fixtures/scopes".to_string(); |
|
|
|
|
wasm_pack::command::init::create_pkg_dir(&path, &step).unwrap(); |
|
|
|
|
assert!(manifest::write_package_json(&path, &Some("test".to_string()), false, "", &step).is_ok()); |
|
|
|
|
assert!( |
|
|
|
|
manifest::write_package_json(&path, &Some("test".to_string()), false, "", &step).is_ok() |
|
|
|
|
); |
|
|
|
|
let package_json_path = format!("{}/pkg/package.json", &path); |
|
|
|
|
assert!(fs::metadata(package_json_path).is_ok()); |
|
|
|
|
assert!(utils::read_package_json(&path).is_ok()); |
|
|
|
@ -110,10 +109,8 @@ fn it_creates_a_package_json_provided_path_with_scope() { |
|
|
|
|
assert_eq!(pkg.main, "scopes_hello_world.js"); |
|
|
|
|
|
|
|
|
|
let actual_files: HashSet<String> = pkg.files.into_iter().collect(); |
|
|
|
|
let expected_files: HashSet<String> = [ |
|
|
|
|
"scopes_hello_world_bg.wasm", |
|
|
|
|
"scopes_hello_world.d.ts", |
|
|
|
|
].iter() |
|
|
|
|
let expected_files: HashSet<String> = ["scopes_hello_world_bg.wasm", "scopes_hello_world.d.ts"] |
|
|
|
|
.iter() |
|
|
|
|
.map(|&s| String::from(s)) |
|
|
|
|
.collect(); |
|
|
|
|
assert_eq!(actual_files, expected_files); |
|
|
|
@ -167,11 +164,10 @@ fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() { |
|
|
|
|
assert_eq!(pkg.main, "wasm_pack.js"); |
|
|
|
|
|
|
|
|
|
let actual_files: HashSet<String> = pkg.files.into_iter().collect(); |
|
|
|
|
let expected_files: HashSet<String> = |
|
|
|
|
["wasm_pack_bg.wasm"] |
|
|
|
|
.iter() |
|
|
|
|
.map(|&s| String::from(s)) |
|
|
|
|
.collect(); |
|
|
|
|
let expected_files: HashSet<String> = ["wasm_pack_bg.wasm"] |
|
|
|
|
.iter() |
|
|
|
|
.map(|&s| String::from(s)) |
|
|
|
|
.collect(); |
|
|
|
|
assert_eq!(actual_files, expected_files); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|