@@ -5,10 +5,10 @@ use assert_cmd::prelude::*;
5
5
use command_extra:: CommandExtra ;
6
6
use pacquet_testing_utils:: {
7
7
bin:: { AddDefaultNpmrcInfo , CommandTempCwd } ,
8
- fs:: { get_all_files, get_all_folders, is_symlink_or_junction} ,
8
+ fs:: { get_all_files, get_all_folders, is_symlink_or_junction} , panic_after ,
9
9
} ;
10
10
use pipe_trait:: Pipe ;
11
- use std:: fs ;
11
+ use std:: { fs , thread , time :: Duration } ;
12
12
13
13
#[ test]
14
14
fn should_install_dependencies ( ) {
@@ -140,3 +140,32 @@ fn should_install_index_files() {
140
140
141
141
drop ( root) ; // cleanup
142
142
}
143
+
144
+ #[ test]
145
+ fn should_install_duplicated_dependencies ( ) {
146
+ let CommandTempCwd { pacquet, root, workspace, .. } =
147
+ CommandTempCwd :: init ( ) . add_default_npmrc ( ) ;
148
+
149
+ eprintln ! ( "Creating package.json..." ) ;
150
+ let manifest_path = workspace. join ( "package.json" ) ;
151
+ let package_json_content = serde_json:: json!( {
152
+ "dependencies" : {
153
+ "express" : "4.18.2" ,
154
+ } ,
155
+ "devDependencies" : {
156
+ "express" : "4.18.2" ,
157
+ } ,
158
+ } ) ;
159
+ fs:: write ( manifest_path, package_json_content. to_string ( ) ) . expect ( "write to package.json" ) ;
160
+
161
+ panic_after ( Duration :: from_secs ( 30 ) , move || {
162
+ thread:: sleep ( Duration :: from_millis ( 200 ) ) ;
163
+ eprintln ! ( "Executing command..." ) ;
164
+ pacquet. with_arg ( "install" ) . assert ( ) . success ( ) ;
165
+ eprintln ! ( "Make sure the package is installed" ) ;
166
+ assert ! ( is_symlink_or_junction( & workspace. join( "node_modules/express" ) ) . unwrap( ) ) ;
167
+ assert ! ( workspace
. join
( "node_modules/.pnpm/[email protected] " ) . exists
( ) ) ;
168
+ } ) ;
169
+
170
+ drop ( root) ; // cleanup
171
+ }
0 commit comments