@@ -41,18 +41,15 @@ describe("isNodeApiModule", () => {
4141 }
4242 } ) ;
4343
44- it ( "returns false when module file exists but is not readable" , ( context ) => {
44+ it ( "throws when module file exists but is not readable" , ( context ) => {
4545 const tempDirectoryPath = setupTempDirectory ( context , {
4646 "addon.android.node" : "" ,
4747 } ) ;
4848 const candidate = path . join ( tempDirectoryPath , "addon.android.node" ) ;
4949 // remove read permission on file
5050 fs . chmodSync ( candidate , 0 ) ;
5151 try {
52- assert . equal (
53- isNodeApiModule ( path . join ( tempDirectoryPath , "addon" ) ) ,
54- false
55- ) ;
52+ assert . throws ( ( ) => isNodeApiModule ( path . join ( tempDirectoryPath , "addon" ) ) , / s k i p p i n g u n r e a d a b l e m o d u l e a d d o n \. a n d r o i d \. n o d e / ) ;
5653 } finally {
5754 fs . chmodSync ( candidate , 0o600 ) ;
5855 }
@@ -76,19 +73,15 @@ describe("isNodeApiModule", () => {
7673 assert . equal ( isNodeApiModule ( path . join ( tempDirectoryPath , "nope" ) ) , false ) ;
7774 } ) ;
7875
79- it ( "returns true and warns when one module unreadable but another readable" , ( context ) => {
76+ it ( "throws when one module unreadable but another readable" , ( context ) => {
8077 const tempDirectoryPath = setupTempDirectory ( context , {
8178 "addon.android.node" : "" ,
8279 "addon.xcframework" : "" ,
8380 } ) ;
8481 const unreadable = path . join ( tempDirectoryPath , "addon.android.node" ) ;
8582 // only android module is unreadable
8683 fs . chmodSync ( unreadable , 0 ) ;
87- const warnings : string [ ] = [ ] ;
88- themock . method ( console , 'warn' , ( msg : string ) => warnings . push ( msg ) ) ;
89- const result = isNodeApiModule ( path . join ( tempDirectoryPath , "addon" ) ) ;
90- assert . equal ( result , true ) ;
91- assert . deepEqual ( warnings , [ "skipping unreadable module addon.android.node" ] ) ;
84+ assert . throws ( ( ) => isNodeApiModule ( path . join ( tempDirectoryPath , "addon" ) ) , / s k i p p i n g u n r e a d a b l e m o d u l e a d d o n \. a n d r o i d \. n o d e / ) ;
9285 fs . chmodSync ( unreadable , 0o600 ) ;
9386 } ) ;
9487} ) ;
0 commit comments