|
|
|
@ -65,11 +65,9 @@ fn it_creates_a_package_json_default_path() { |
|
|
|
|
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); |
|
|
|
|
let step = wasm_pack::progressbar::Step::new(1); |
|
|
|
|
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); |
|
|
|
|
assert!( |
|
|
|
|
crate_data |
|
|
|
|
.write_package_json(&out_dir, &None, false, "", &step) |
|
|
|
|
.is_ok() |
|
|
|
|
); |
|
|
|
|
assert!(crate_data |
|
|
|
|
.write_package_json(&out_dir, &None, false, "", &step) |
|
|
|
|
.is_ok()); |
|
|
|
|
let package_json_path = &fixture.path.join("pkg").join("package.json"); |
|
|
|
|
fs::metadata(package_json_path).unwrap(); |
|
|
|
|
utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); |
|
|
|
@ -90,9 +88,9 @@ fn it_creates_a_package_json_default_path() { |
|
|
|
|
"js_hello_world.d.ts", |
|
|
|
|
"js_hello_world.js", |
|
|
|
|
] |
|
|
|
|
.iter() |
|
|
|
|
.map(|&s| String::from(s)) |
|
|
|
|
.collect(); |
|
|
|
|
.iter() |
|
|
|
|
.map(|&s| String::from(s)) |
|
|
|
|
.collect(); |
|
|
|
|
assert_eq!(actual_files, expected_files); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -103,11 +101,9 @@ fn it_creates_a_package_json_provided_path() { |
|
|
|
|
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); |
|
|
|
|
let step = wasm_pack::progressbar::Step::new(1); |
|
|
|
|
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); |
|
|
|
|
assert!( |
|
|
|
|
crate_data |
|
|
|
|
.write_package_json(&out_dir, &None, false, "", &step) |
|
|
|
|
.is_ok() |
|
|
|
|
); |
|
|
|
|
assert!(crate_data |
|
|
|
|
.write_package_json(&out_dir, &None, false, "", &step) |
|
|
|
|
.is_ok()); |
|
|
|
|
let package_json_path = &fixture.path.join("pkg").join("package.json"); |
|
|
|
|
fs::metadata(package_json_path).unwrap(); |
|
|
|
|
utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); |
|
|
|
@ -121,9 +117,9 @@ fn it_creates_a_package_json_provided_path() { |
|
|
|
|
"js_hello_world.d.ts", |
|
|
|
|
"js_hello_world.js", |
|
|
|
|
] |
|
|
|
|
.iter() |
|
|
|
|
.map(|&s| String::from(s)) |
|
|
|
|
.collect(); |
|
|
|
|
.iter() |
|
|
|
|
.map(|&s| String::from(s)) |
|
|
|
|
.collect(); |
|
|
|
|
assert_eq!(actual_files, expected_files); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -134,11 +130,9 @@ fn it_creates_a_package_json_provided_path_with_scope() { |
|
|
|
|
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); |
|
|
|
|
let step = wasm_pack::progressbar::Step::new(1); |
|
|
|
|
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); |
|
|
|
|
assert!( |
|
|
|
|
crate_data |
|
|
|
|
.write_package_json(&out_dir, &Some("test".to_string()), false, "", &step) |
|
|
|
|
.is_ok() |
|
|
|
|
); |
|
|
|
|
assert!(crate_data |
|
|
|
|
.write_package_json(&out_dir, &Some("test".to_string()), false, "", &step) |
|
|
|
|
.is_ok()); |
|
|
|
|
let package_json_path = &fixture.path.join("pkg").join("package.json"); |
|
|
|
|
fs::metadata(package_json_path).unwrap(); |
|
|
|
|
utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); |
|
|
|
@ -152,9 +146,9 @@ fn it_creates_a_package_json_provided_path_with_scope() { |
|
|
|
|
"js_hello_world.d.ts", |
|
|
|
|
"js_hello_world.js", |
|
|
|
|
] |
|
|
|
|
.iter() |
|
|
|
|
.map(|&s| String::from(s)) |
|
|
|
|
.collect(); |
|
|
|
|
.iter() |
|
|
|
|
.map(|&s| String::from(s)) |
|
|
|
|
.collect(); |
|
|
|
|
assert_eq!(actual_files, expected_files); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -165,11 +159,9 @@ fn it_creates_a_pkg_json_with_correct_files_on_node() { |
|
|
|
|
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); |
|
|
|
|
let step = wasm_pack::progressbar::Step::new(1); |
|
|
|
|
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); |
|
|
|
|
assert!( |
|
|
|
|
crate_data |
|
|
|
|
.write_package_json(&out_dir, &None, false, "nodejs", &step) |
|
|
|
|
.is_ok() |
|
|
|
|
); |
|
|
|
|
assert!(crate_data |
|
|
|
|
.write_package_json(&out_dir, &None, false, "nodejs", &step) |
|
|
|
|
.is_ok()); |
|
|
|
|
let package_json_path = &out_dir.join("package.json"); |
|
|
|
|
fs::metadata(package_json_path).unwrap(); |
|
|
|
|
utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); |
|
|
|
@ -190,9 +182,9 @@ fn it_creates_a_pkg_json_with_correct_files_on_node() { |
|
|
|
|
"js_hello_world.d.ts", |
|
|
|
|
"js_hello_world.js", |
|
|
|
|
] |
|
|
|
|
.iter() |
|
|
|
|
.map(|&s| String::from(s)) |
|
|
|
|
.collect(); |
|
|
|
|
.iter() |
|
|
|
|
.map(|&s| String::from(s)) |
|
|
|
|
.collect(); |
|
|
|
|
assert_eq!(actual_files, expected_files); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -203,11 +195,9 @@ fn it_creates_a_pkg_json_with_correct_files_on_nomodules() { |
|
|
|
|
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); |
|
|
|
|
let step = wasm_pack::progressbar::Step::new(1); |
|
|
|
|
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); |
|
|
|
|
assert!( |
|
|
|
|
crate_data |
|
|
|
|
.write_package_json(&out_dir, &None, false, "no-modules", &step) |
|
|
|
|
.is_ok() |
|
|
|
|
); |
|
|
|
|
assert!(crate_data |
|
|
|
|
.write_package_json(&out_dir, &None, false, "no-modules", &step) |
|
|
|
|
.is_ok()); |
|
|
|
|
let package_json_path = &out_dir.join("package.json"); |
|
|
|
|
fs::metadata(package_json_path).unwrap(); |
|
|
|
|
utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); |
|
|
|
@ -227,9 +217,9 @@ fn it_creates_a_pkg_json_with_correct_files_on_nomodules() { |
|
|
|
|
"js_hello_world.js", |
|
|
|
|
"js_hello_world.d.ts", |
|
|
|
|
] |
|
|
|
|
.iter() |
|
|
|
|
.map(|&s| String::from(s)) |
|
|
|
|
.collect(); |
|
|
|
|
.iter() |
|
|
|
|
.map(|&s| String::from(s)) |
|
|
|
|
.collect(); |
|
|
|
|
assert_eq!(actual_files, expected_files); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -240,11 +230,9 @@ fn it_creates_a_pkg_json_in_out_dir() { |
|
|
|
|
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); |
|
|
|
|
let step = wasm_pack::progressbar::Step::new(1); |
|
|
|
|
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); |
|
|
|
|
assert!( |
|
|
|
|
crate_data |
|
|
|
|
.write_package_json(&out_dir, &None, false, "", &step) |
|
|
|
|
.is_ok() |
|
|
|
|
); |
|
|
|
|
assert!(crate_data |
|
|
|
|
.write_package_json(&out_dir, &None, false, "", &step) |
|
|
|
|
.is_ok()); |
|
|
|
|
|
|
|
|
|
let package_json_path = &fixture.path.join(&out_dir).join("package.json"); |
|
|
|
|
fs::metadata(package_json_path).unwrap(); |
|
|
|
@ -258,11 +246,9 @@ fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() { |
|
|
|
|
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); |
|
|
|
|
let step = wasm_pack::progressbar::Step::new(1); |
|
|
|
|
wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); |
|
|
|
|
assert!( |
|
|
|
|
crate_data |
|
|
|
|
.write_package_json(&out_dir, &None, true, "", &step) |
|
|
|
|
.is_ok() |
|
|
|
|
); |
|
|
|
|
assert!(crate_data |
|
|
|
|
.write_package_json(&out_dir, &None, true, "", &step) |
|
|
|
|
.is_ok()); |
|
|
|
|
let package_json_path = &out_dir.join("package.json"); |
|
|
|
|
fs::metadata(package_json_path).unwrap(); |
|
|
|
|
utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); |
|
|
|
|