@@ -20,6 +20,7 @@ const { npmInstall, npmInstallDependencies } = require("..");
20
20
describe ( "npm-install" , ( ) => {
21
21
childProcess . exec . mockResolvedValue ( ) ;
22
22
fs . rename . mockResolvedValue ( ) ;
23
+ fs . copy . mockResolvedValue ( ) ;
23
24
writePkg . mockResolvedValue ( ) ;
24
25
25
26
describe ( "npmInstall()" , ( ) => {
@@ -141,7 +142,7 @@ describe("npm-install", () => {
141
142
142
143
await npmInstallDependencies ( pkg , dependencies , { } ) ;
143
144
144
- expect ( fs . rename ) . toHaveBeenLastCalledWith ( pkg . manifestLocation , backupManifest ) ;
145
+ expect ( fs . copy ) . toHaveBeenLastCalledWith ( pkg . manifestLocation , backupManifest ) ;
145
146
expect ( fs . renameSync ) . toHaveBeenLastCalledWith ( backupManifest , pkg . manifestLocation ) ;
146
147
expect ( writePkg ) . toHaveBeenLastCalledWith ( pkg . manifestLocation , {
147
148
name :"npm-install-deps" ,
@@ -463,19 +464,19 @@ describe("npm-install", () => {
463
464
} ) ;
464
465
} ) ;
465
466
466
- it ( "rejects withrename error" , async ( ) => {
467
+ it ( "rejects withcopy error" , async ( ) => {
467
468
const pkg = new Package (
468
469
{
469
- name :"npm-install-deps-rename -error" ,
470
+ name :"npm-install-deps-copy -error" ,
470
471
version :"1.0.0" ,
471
472
} ,
472
- path . normalize ( "/test/npm-install-deps/renameError " )
473
+ path . normalize ( "/test/npm-install-deps/copyError " )
473
474
) ;
474
475
const dependencies = [ "I'm just here so we don't exit early" ] ;
475
476
476
- fs . rename . mockRejectedValueOnce ( new Error ( "Unable torename file" ) ) ;
477
+ fs . copy . mockRejectedValueOnce ( new Error ( "Unable tocopy file" ) ) ;
477
478
478
- await expect ( npmInstallDependencies ( pkg , dependencies , { } ) ) . rejects . toThrow ( "Unable torename file" ) ;
479
+ await expect ( npmInstallDependencies ( pkg , dependencies , { } ) ) . rejects . toThrow ( "Unable tocopy file" ) ;
479
480
} ) ;
480
481
481
482
it ( "cleans up synchronously after writeFile error" , async ( ) => {