@@ -4,6 +4,7 @@ use std::fs;
4
4
use std:: path:: PathBuf ;
5
5
use utils:: { self , fixture} ;
6
6
use wasm_pack:: { self , license, manifest} ;
7
+ use wasm_pack:: command:: build:: Target ;
7
8
8
9
#[ test]
9
10
fn it_gets_the_crate_name_default_path ( ) {
@@ -66,7 +67,7 @@ fn it_creates_a_package_json_default_path() {
66
67
let step = wasm_pack:: progressbar:: Step :: new ( 1 ) ;
67
68
wasm_pack:: command:: utils:: create_pkg_dir ( & out_dir, & step) . unwrap ( ) ;
68
69
assert ! ( crate_data
69
- . write_package_json( & out_dir, & None , false , "" , & step)
70
+ . write_package_json( & out_dir, & None , false , & Target :: Bundler , & step)
70
71
. is_ok( ) ) ;
71
72
let package_json_path = & fixture. path . join ( "pkg" ) . join ( "package.json" ) ;
72
73
fs:: metadata ( package_json_path) . unwrap ( ) ;
@@ -102,7 +103,7 @@ fn it_creates_a_package_json_provided_path() {
102
103
let step = wasm_pack:: progressbar:: Step :: new ( 1 ) ;
103
104
wasm_pack:: command:: utils:: create_pkg_dir ( & out_dir, & step) . unwrap ( ) ;
104
105
assert ! ( crate_data
105
- . write_package_json( & out_dir, & None , false , "" , & step)
106
+ . write_package_json( & out_dir, & None , false , & Target :: Bundler , & step)
106
107
. is_ok( ) ) ;
107
108
let package_json_path = & fixture. path . join ( "pkg" ) . join ( "package.json" ) ;
108
109
fs:: metadata ( package_json_path) . unwrap ( ) ;
@@ -131,7 +132,7 @@ fn it_creates_a_package_json_provided_path_with_scope() {
131
132
let step = wasm_pack:: progressbar:: Step :: new ( 1 ) ;
132
133
wasm_pack:: command:: utils:: create_pkg_dir ( & out_dir, & step) . unwrap ( ) ;
133
134
assert ! ( crate_data
134
- . write_package_json( & out_dir, & Some ( "test" . to_string( ) ) , false , "" , & step)
135
+ . write_package_json( & out_dir, & Some ( "test" . to_string( ) ) , false , & Target :: Bundler , & step)
135
136
. is_ok( ) ) ;
136
137
let package_json_path = & fixture. path . join ( "pkg" ) . join ( "package.json" ) ;
137
138
fs:: metadata ( package_json_path) . unwrap ( ) ;
@@ -160,7 +161,7 @@ fn it_creates_a_pkg_json_with_correct_files_on_node() {
160
161
let step = wasm_pack:: progressbar:: Step :: new ( 1 ) ;
161
162
wasm_pack:: command:: utils:: create_pkg_dir ( & out_dir, & step) . unwrap ( ) ;
162
163
assert ! ( crate_data
163
- . write_package_json( & out_dir, & None , false , "nodejs" , & step)
164
+ . write_package_json( & out_dir, & None , false , & Target :: Nodejs , & step)
164
165
. is_ok( ) ) ;
165
166
let package_json_path = & out_dir. join ( "package.json" ) ;
166
167
fs:: metadata ( package_json_path) . unwrap ( ) ;
@@ -196,7 +197,7 @@ fn it_creates_a_pkg_json_with_correct_files_on_nomodules() {
196
197
let step = wasm_pack:: progressbar:: Step :: new ( 1 ) ;
197
198
wasm_pack:: command:: utils:: create_pkg_dir ( & out_dir, & step) . unwrap ( ) ;
198
199
assert ! ( crate_data
199
- . write_package_json( & out_dir, & None , false , "no-modules" , & step)
200
+ . write_package_json( & out_dir, & None , false , & Target :: NoModules , & step)
200
201
. is_ok( ) ) ;
201
202
let package_json_path = & out_dir. join ( "package.json" ) ;
202
203
fs:: metadata ( package_json_path) . unwrap ( ) ;
@@ -231,7 +232,7 @@ fn it_creates_a_pkg_json_in_out_dir() {
231
232
let step = wasm_pack:: progressbar:: Step :: new ( 1 ) ;
232
233
wasm_pack:: command:: utils:: create_pkg_dir ( & out_dir, & step) . unwrap ( ) ;
233
234
assert ! ( crate_data
234
- . write_package_json( & out_dir, & None , false , "" , & step)
235
+ . write_package_json( & out_dir, & None , false , & Target :: Bundler , & step)
235
236
. is_ok( ) ) ;
236
237
237
238
let package_json_path = & fixture. path . join ( & out_dir) . join ( "package.json" ) ;
@@ -247,7 +248,7 @@ fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() {
247
248
let step = wasm_pack:: progressbar:: Step :: new ( 1 ) ;
248
249
wasm_pack:: command:: utils:: create_pkg_dir ( & out_dir, & step) . unwrap ( ) ;
249
250
assert ! ( crate_data
250
- . write_package_json( & out_dir, & None , true , "" , & step)
251
+ . write_package_json( & out_dir, & None , true , & Target :: Bundler , & step)
251
252
. is_ok( ) ) ;
252
253
let package_json_path = & out_dir. join ( "package.json" ) ;
253
254
fs:: metadata ( package_json_path) . unwrap ( ) ;
@@ -310,7 +311,7 @@ fn it_sets_homepage_field_if_available_in_cargo_toml() {
310
311
let step = wasm_pack:: progressbar:: Step :: new ( 2 ) ;
311
312
wasm_pack:: command:: utils:: create_pkg_dir ( & out_dir, & step) . unwrap ( ) ;
312
313
crate_data
313
- . write_package_json ( & out_dir, & None , true , "" , & step)
314
+ . write_package_json ( & out_dir, & None , true , & Target :: Bundler , & step)
314
315
. unwrap ( ) ;
315
316
316
317
let pkg = utils:: manifest:: read_package_json ( & fixture. path , & out_dir) . unwrap ( ) ;
@@ -327,7 +328,7 @@ fn it_sets_homepage_field_if_available_in_cargo_toml() {
327
328
let step = wasm_pack:: progressbar:: Step :: new ( 2 ) ;
328
329
wasm_pack:: command:: utils:: create_pkg_dir ( & out_dir, & step) . unwrap ( ) ;
329
330
crate_data
330
- . write_package_json ( & out_dir, & None , true , "" , & step)
331
+ . write_package_json ( & out_dir, & None , true , & Target :: Bundler , & step)
331
332
. unwrap ( ) ;
332
333
333
334
let pkg = utils:: manifest:: read_package_json ( & fixture. path , & out_dir) . unwrap ( ) ;
@@ -430,7 +431,7 @@ fn it_lists_license_files_in_files_field_of_package_json() {
430
431
wasm_pack:: command:: utils:: create_pkg_dir ( & out_dir, & step) . unwrap ( ) ;
431
432
license:: copy_from_crate ( & crate_data, & fixture. path , & out_dir, & step) . unwrap ( ) ;
432
433
crate_data
433
- . write_package_json ( & out_dir, & None , false , "" , & step)
434
+ . write_package_json ( & out_dir, & None , false , & Target :: Bundler , & step)
434
435
. unwrap ( ) ;
435
436
436
437
let package_json_path = & fixture. path . join ( "pkg" ) . join ( "package.json" ) ;
0 commit comments