@@ -2,7 +2,7 @@ import { expect } from 'chai';
22import * as cp from 'node:child_process' ;
33import * as http from 'node:http' ;
44import * as express from 'express' ;
5- import * as fs from 'fs-extra ' ;
5+ import * as fs from 'node:fs ' ;
66import * as path from 'node:path' ;
77import * as psList from 'ps-list' ;
88import { AddressInfo } from 'node:net' ;
@@ -68,14 +68,14 @@ ifdescribe(shouldRunCodesignTests)('autoUpdater behavior', function () {
6868 await withTempDirectory ( async ( dir ) => {
6969 const secondAppPath = await copyMacOSFixtureApp ( dir , fixture ) ;
7070 const appPJPath = path . resolve ( secondAppPath , 'Contents' , 'Resources' , 'app' , 'package.json' ) ;
71- await fs . writeFile (
71+ await fs . promises . writeFile (
7272 appPJPath ,
73- ( await fs . readFile ( appPJPath , 'utf8' ) ) . replace ( '1.0.0' , version )
73+ ( await fs . promises . readFile ( appPJPath , 'utf8' ) ) . replace ( '1.0.0' , version )
7474 ) ;
7575 const infoPath = path . resolve ( secondAppPath , 'Contents' , 'Info.plist' ) ;
76- await fs . writeFile (
76+ await fs . promises . writeFile (
7777 infoPath ,
78- ( await fs . readFile ( infoPath , 'utf8' ) ) . replace ( / ( < k e y > C F B u n d l e S h o r t V e r s i o n S t r i n g < \/ k e y > \s + < s t r i n g > ) [ ^ < ] + / g, `$1${ version } ` )
78+ ( await fs . promises . readFile ( infoPath , 'utf8' ) ) . replace ( / ( < k e y > C F B u n d l e S h o r t V e r s i o n S t r i n g < \/ k e y > \s + < s t r i n g > ) [ ^ < ] + / g, `$1${ version } ` )
7979 ) ;
8080 await mutateAppPreSign ?. mutate ( secondAppPath ) ;
8181 await signApp ( secondAppPath , identity ) ;
@@ -221,9 +221,9 @@ ifdescribe(shouldRunCodesignTests)('autoUpdater behavior', function () {
221221 const appPath = await copyMacOSFixtureApp ( dir , opts . startFixture ) ;
222222 await opts . mutateAppPreSign ?. mutate ( appPath ) ;
223223 const infoPath = path . resolve ( appPath , 'Contents' , 'Info.plist' ) ;
224- await fs . writeFile (
224+ await fs . promises . writeFile (
225225 infoPath ,
226- ( await fs . readFile ( infoPath , 'utf8' ) ) . replace ( / ( < k e y > C F B u n d l e S h o r t V e r s i o n S t r i n g < \/ k e y > \s + < s t r i n g > ) [ ^ < ] + / g, '$11.0.0' )
226+ ( await fs . promises . readFile ( infoPath , 'utf8' ) ) . replace ( / ( < k e y > C F B u n d l e S h o r t V e r s i o n S t r i n g < \/ k e y > \s + < s t r i n g > ) [ ^ < ] + / g, '$11.0.0' )
227227 ) ;
228228 await signApp ( appPath , identity ) ;
229229
@@ -378,9 +378,9 @@ ifdescribe(shouldRunCodesignTests)('autoUpdater behavior', function () {
378378 mutationKey : 'prevent-downgrades' ,
379379 mutate : async ( appPath ) => {
380380 const infoPath = path . resolve ( appPath , 'Contents' , 'Info.plist' ) ;
381- await fs . writeFile (
381+ await fs . promises . writeFile (
382382 infoPath ,
383- ( await fs . readFile ( infoPath , 'utf8' ) ) . replace ( '<key>NSSupportsAutomaticGraphicsSwitching</key>' , '<key>ElectronSquirrelPreventDowngrades</key><true/><key>NSSupportsAutomaticGraphicsSwitching</key>' )
383+ ( await fs . promises . readFile ( infoPath , 'utf8' ) ) . replace ( '<key>NSSupportsAutomaticGraphicsSwitching</key>' , '<key>ElectronSquirrelPreventDowngrades</key><true/><key>NSSupportsAutomaticGraphicsSwitching</key>' )
384384 ) ;
385385 }
386386 }
@@ -418,9 +418,9 @@ ifdescribe(shouldRunCodesignTests)('autoUpdater behavior', function () {
418418 mutationKey : 'prevent-downgrades' ,
419419 mutate : async ( appPath ) => {
420420 const infoPath = path . resolve ( appPath , 'Contents' , 'Info.plist' ) ;
421- await fs . writeFile (
421+ await fs . promises . writeFile (
422422 infoPath ,
423- ( await fs . readFile ( infoPath , 'utf8' ) ) . replace ( '<key>NSSupportsAutomaticGraphicsSwitching</key>' , '<key>ElectronSquirrelPreventDowngrades</key><true/><key>NSSupportsAutomaticGraphicsSwitching</key>' )
423+ ( await fs . promises . readFile ( infoPath , 'utf8' ) ) . replace ( '<key>NSSupportsAutomaticGraphicsSwitching</key>' , '<key>ElectronSquirrelPreventDowngrades</key><true/><key>NSSupportsAutomaticGraphicsSwitching</key>' )
424424 ) ;
425425 }
426426 }
@@ -558,7 +558,7 @@ ifdescribe(shouldRunCodesignTests)('autoUpdater behavior', function () {
558558
559559 await shipItFlipFlopPromise ;
560560 expect ( requests ) . to . have . lengthOf ( 2 , 'should not have relaunched the updated app' ) ;
561- expect ( JSON . parse ( await fs . readFile ( path . resolve ( appPath , 'Contents/Resources/app/package.json' ) , 'utf8' ) ) . version ) . to . equal ( '1.0.0' , 'should still be the old version on disk' ) ;
561+ expect ( JSON . parse ( await fs . promises . readFile ( path . resolve ( appPath , 'Contents/Resources/app/package.json' ) , 'utf8' ) ) . version ) . to . equal ( '1.0.0' , 'should still be the old version on disk' ) ;
562562
563563 retainerHandle . kill ( 'SIGINT' ) ;
564564 } ) ;
@@ -631,7 +631,7 @@ ifdescribe(shouldRunCodesignTests)('autoUpdater behavior', function () {
631631 mutationKey : 'add-resource' ,
632632 mutate : async ( appPath ) => {
633633 const resourcesPath = path . resolve ( appPath , 'Contents' , 'Resources' , 'app' , 'injected.txt' ) ;
634- await fs . writeFile ( resourcesPath , 'demo' ) ;
634+ await fs . promises . writeFile ( resourcesPath , 'demo' ) ;
635635 }
636636 }
637637 } , async ( appPath , updateZipPath ) => {
@@ -669,8 +669,8 @@ ifdescribe(shouldRunCodesignTests)('autoUpdater behavior', function () {
669669 mutationKey : 'modify-shipit' ,
670670 mutate : async ( appPath ) => {
671671 const shipItPath = path . resolve ( appPath , 'Contents' , 'Frameworks' , 'Squirrel.framework' , 'Resources' , 'ShipIt' ) ;
672- await fs . remove ( shipItPath ) ;
673- await fs . symlink ( '/tmp/ShipIt' , shipItPath , 'file' ) ;
672+ await fs . promises . rm ( shipItPath , { force : true , recursive : true } ) ;
673+ await fs . promises . symlink ( '/tmp/ShipIt' , shipItPath , 'file' ) ;
674674 }
675675 }
676676 } , async ( appPath , updateZipPath ) => {
@@ -708,7 +708,7 @@ ifdescribe(shouldRunCodesignTests)('autoUpdater behavior', function () {
708708 mutationKey : 'modify-eframework' ,
709709 mutate : async ( appPath ) => {
710710 const shipItPath = path . resolve ( appPath , 'Contents' , 'Frameworks' , 'Electron Framework.framework' , 'Electron Framework' ) ;
711- await fs . appendFile ( shipItPath , Buffer . from ( '123' ) ) ;
711+ await fs . promises . appendFile ( shipItPath , Buffer . from ( '123' ) ) ;
712712 }
713713 }
714714 } , async ( appPath , updateZipPath ) => {
0 commit comments