diff --git a/tests/all/manifest.rs b/tests/all/manifest.rs index c25c3e5..f7cf57a 100644 --- a/tests/all/manifest.rs +++ b/tests/all/manifest.rs @@ -86,12 +86,13 @@ fn it_creates_a_package_json_default_path() { utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); let pkg = utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); assert_eq!(pkg.name, "js-hello-world"); + assert_eq!(pkg.ty, "module"); assert_eq!(pkg.repository.ty, "git"); assert_eq!( pkg.repository.url, "https://github.com/rustwasm/wasm-pack.git" ); - assert_eq!(pkg.module, "js_hello_world.js"); + assert_eq!(pkg.main, "js_hello_world.js"); assert_eq!(pkg.types, "js_hello_world.d.ts"); assert_eq!(pkg.side_effects, false); @@ -122,7 +123,8 @@ fn it_creates_a_package_json_provided_path() { utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); let pkg = utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); assert_eq!(pkg.name, "js-hello-world"); - assert_eq!(pkg.module, "js_hello_world.js"); + assert_eq!(pkg.ty, "module"); + assert_eq!(pkg.main, "js_hello_world.js"); let actual_files: HashSet<String> = pkg.files.into_iter().collect(); let expected_files: HashSet<String> = [ @@ -151,7 +153,8 @@ fn it_creates_a_package_json_provided_path_with_scope() { utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); let pkg = utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); assert_eq!(pkg.name, "@test/js-hello-world"); - assert_eq!(pkg.module, "js_hello_world.js"); + assert_eq!(pkg.ty, "module"); + assert_eq!(pkg.main, "js_hello_world.js"); let actual_files: HashSet<String> = pkg.files.into_iter().collect(); let expected_files: HashSet<String> = [ @@ -248,12 +251,13 @@ fn it_creates_a_package_json_with_correct_files_when_out_name_is_provided() { utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); let pkg = utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); assert_eq!(pkg.name, "js-hello-world"); + assert_eq!(pkg.ty, "module"); assert_eq!(pkg.repository.ty, "git"); assert_eq!( pkg.repository.url, "https://github.com/rustwasm/wasm-pack.git" ); - assert_eq!(pkg.module, "index.js"); + assert_eq!(pkg.main, "index.js"); assert_eq!(pkg.types, "index.d.ts"); assert_eq!(pkg.side_effects, false); @@ -295,12 +299,13 @@ fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() { utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); let pkg = utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); assert_eq!(pkg.name, "js-hello-world"); + assert_eq!(pkg.ty, "module"); assert_eq!(pkg.repository.ty, "git"); assert_eq!( pkg.repository.url, "https://github.com/rustwasm/wasm-pack.git" ); - assert_eq!(pkg.module, "js_hello_world.js"); + assert_eq!(pkg.main, "js_hello_world.js"); let actual_files: HashSet<String> = pkg.files.into_iter().collect(); let expected_files: HashSet<String> = [ diff --git a/tests/all/utils/manifest.rs b/tests/all/utils/manifest.rs index c261bc1..da5d2ea 100644 --- a/tests/all/utils/manifest.rs +++ b/tests/all/utils/manifest.rs @@ -8,6 +8,8 @@ use serde_json; #[derive(Deserialize)] pub struct NpmPackage { pub name: String, + #[serde(default = "default_none", rename = "type")] + pub ty: String, pub description: String, pub version: String, pub license: String,