Working but may need changes

master
lucashorward 5 years ago
parent 9209df9862
commit bad4282fc5
  1. 6
      src/manifest/mod.rs
  2. 16
      tests/all/manifest.rs

@ -588,10 +588,10 @@ impl CrateData {
let mut files = vec![wasm_file];
files.push(js_file.clone());
if include_commonjs_shim {
// if include_commonjs_shim {
let js_bg_file = format!("{}_bg.js", name_prefix);
files.push(js_bg_file);
}
// }
let pkg = &self.data.packages[self.current_idx];
let npm_name = match scope {
@ -734,7 +734,7 @@ impl CrateData {
disable_dts: bool,
out_dir: &Path,
) -> NpmPackage {
let data = self.npm_data(scope, false, disable_dts, out_dir);
let data = self.npm_data(scope, true, disable_dts, out_dir);
let pkg = &self.data.packages[self.current_idx];
self.check_optional_fields();

@ -97,8 +97,9 @@ fn it_creates_a_package_json_default_path() {
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",
"js_hello_world_bg.js",
"js_hello_world_bg.wasm",
"js_hello_world.js",
]
.iter()
@ -125,8 +126,9 @@ fn it_creates_a_package_json_provided_path() {
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",
"js_hello_world_bg.js",
"js_hello_world_bg.wasm",
"js_hello_world.js",
]
.iter()
@ -153,8 +155,9 @@ fn it_creates_a_package_json_provided_path_with_scope() {
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",
"js_hello_world_bg.js",
"js_hello_world_bg.wasm",
"js_hello_world.js",
]
.iter()
@ -222,9 +225,10 @@ fn it_creates_a_pkg_json_with_correct_files_on_nomodules() {
let actual_files: HashSet<String> = pkg.files.into_iter().collect();
let expected_files: HashSet<String> = [
"js_hello_world.d.ts",
"js_hello_world_bg.js",
"js_hello_world_bg.wasm",
"js_hello_world.js",
"js_hello_world.d.ts",
]
.iter()
.map(|&s| String::from(s))
@ -256,7 +260,7 @@ fn it_creates_a_package_json_with_correct_files_when_out_name_is_provided() {
assert_eq!(pkg.side_effects, false);
let actual_files: HashSet<String> = pkg.files.into_iter().collect();
let expected_files: HashSet<String> = ["index_bg.wasm", "index.d.ts", "index.js"]
let expected_files: HashSet<String> = ["index_bg.wasm", "index_bg.js", "index.d.ts", "index.js"]
.iter()
.map(|&s| String::from(s))
.collect();
@ -300,7 +304,7 @@ fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() {
assert_eq!(pkg.module, "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.js"]
let expected_files: HashSet<String> = ["js_hello_world_bg.wasm", "js_hello_world_bg.js", "js_hello_world.js"]
.iter()
.map(|&s| String::from(s))
.collect();

Loading…
Cancel
Save