@@ -21,14 +21,16 @@ describe('auth', async function() {
2121 it ( 'asks for auth data if no ncurc is found' , async function ( ) {
2222 await runAuthScript (
2323 undefined ,
24- [ FIRST_TIME_MSG , MOCKED_TOKEN ]
24+ [ FIRST_TIME_MSG , MOCKED_TOKEN ] ,
25+ / ^ S p a w n i n g g p g t o e n c r y p t t h e c o n f i g v a l u e \r ? \n E r r o r : s p a w n d o - n o t - e x i s t E N O E N T (?: .* \n ) + F a i l e d e n c r y p t t o k e n , s t o r i n g u n e n c r y p t e d i n s t e a d \r ? \n $ / ,
2526 ) ;
2627 } ) ;
2728
2829 it ( 'asks for auth data if ncurc is invalid json' , async function ( ) {
2930 await runAuthScript (
3031 { HOME : 'this is not json' } ,
31- [ FIRST_TIME_MSG , MOCKED_TOKEN ]
32+ [ FIRST_TIME_MSG , MOCKED_TOKEN ] ,
33+ / ^ S p a w n i n g g p g t o e n c r y p t t h e c o n f i g v a l u e \r ? \n E r r o r : s p a w n d o - n o t - e x i s t E N O E N T (?: .* \n ) + F a i l e d e n c r y p t t o k e n , s t o r i n g u n e n c r y p t e d i n s t e a d \r ? \n $ / ,
3234 ) ;
3335 } ) ;
3436
@@ -117,7 +119,7 @@ describe('auth', async function() {
117119function runAuthScript (
118120 ncurc = { } , expect = [ ] , error = '' , fixture = 'run-auth-github' ) {
119121 return new Promise ( ( resolve , reject ) => {
120- const newEnv = { HOME : undefined , XDG_CONFIG_HOME : undefined } ;
122+ const newEnv = { HOME : undefined , XDG_CONFIG_HOME : undefined , GPG_BIN : 'do-not-exist' } ;
121123 if ( ncurc . HOME === undefined ) ncurc . HOME = '' ; // HOME must always be set.
122124 for ( const envVar in ncurc ) {
123125 if ( ncurc [ envVar ] === undefined ) continue ;
@@ -154,8 +156,9 @@ function runAuthScript(
154156 } ) ;
155157 proc . on ( 'close' , ( ) => {
156158 try {
157- assert . strictEqual ( stderr , error ) ;
158- assert . strictEqual ( expect . length , 0 ) ;
159+ if ( typeof error === 'string' ) assert . strictEqual ( stderr , error ) ;
160+ else assert . match ( stderr , error ) ;
161+ assert . deepStrictEqual ( expect , [ ] ) ;
159162 if ( newEnv . HOME ) {
160163 fs . rmSync ( newEnv . HOME , { recursive : true , force : true } ) ;
161164 }
0 commit comments