Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/manifest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ impl CrateData {
let js_bg_file = format!("{}_bg.js", name_prefix);
files.push(js_bg_file);
}
files.push("snippets".into());

let pkg = &self.data.packages[self.current_idx];
let npm_name = match scope {
Expand Down
22 changes: 17 additions & 5 deletions tests/all/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ fn it_creates_a_package_json_default_path() {
"js_hello_world_bg.js",
"js_hello_world_bg.wasm",
"js_hello_world.js",
"snippets",
]
.iter()
.map(|&s| String::from(s))
Expand Down Expand Up @@ -135,6 +136,7 @@ fn it_creates_a_package_json_provided_path() {
"js_hello_world_bg.js",
"js_hello_world_bg.wasm",
"js_hello_world.js",
"snippets",
]
.iter()
.map(|&s| String::from(s))
Expand Down Expand Up @@ -165,6 +167,7 @@ fn it_creates_a_package_json_provided_path_with_scope() {
"js_hello_world_bg.js",
"js_hello_world_bg.wasm",
"js_hello_world.js",
"snippets",
]
.iter()
.map(|&s| String::from(s))
Expand Down Expand Up @@ -199,6 +202,7 @@ fn it_creates_a_pkg_json_with_correct_files_on_node() {
"js_hello_world_bg.wasm",
"js_hello_world.d.ts",
"js_hello_world.js",
"snippets",
]
.iter()
.map(|&s| String::from(s))
Expand Down Expand Up @@ -233,6 +237,7 @@ fn it_creates_a_pkg_json_with_correct_files_on_nomodules() {
"js_hello_world.d.ts",
"js_hello_world_bg.wasm",
"js_hello_world.js",
"snippets",
]
.iter()
.map(|&s| String::from(s))
Expand Down Expand Up @@ -265,11 +270,16 @@ fn it_creates_a_package_json_with_correct_files_when_out_name_is_provided() {
assert_eq!(pkg.side_effects, vec!["./index.js", "./snippets/*"]);

let actual_files: HashSet<String> = pkg.files.into_iter().collect();
let expected_files: HashSet<String> =
["index_bg.wasm", "index_bg.js", "index.d.ts", "index.js"]
.iter()
.map(|&s| String::from(s))
.collect();
let expected_files: HashSet<String> = [
"index_bg.wasm",
"index_bg.js",
"index.d.ts",
"index.js",
"snippets",
]
.iter()
.map(|&s| String::from(s))
.collect();
assert_eq!(actual_files, expected_files);
}

Expand Down Expand Up @@ -315,6 +325,7 @@ fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() {
"js_hello_world_bg.wasm",
"js_hello_world_bg.js",
"js_hello_world.js",
"snippets",
]
.iter()
.map(|&s| String::from(s))
Expand Down Expand Up @@ -356,6 +367,7 @@ fn it_creates_a_package_json_with_npm_dependencies_provided_by_wasm_bindgen() {
"js_hello_world_bg.wasm",
"js_hello_world_bg.js",
"js_hello_world.js",
"snippets",
]
.iter()
.map(|&s| String::from(s))
Expand Down