File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ export class Package {
67
67
* Note that this function should not be run in the same Node process that imports the installed
68
68
* module
69
69
**/
70
- async install ( ) : Promise < void > {
70
+ async install ( inheritOutput = false ) : Promise < void > {
71
71
console . error ( 'installing' ) ;
72
72
let source : string ;
73
73
switch ( this . type ) {
@@ -98,9 +98,12 @@ export class Package {
98
98
{ encoding : 'utf8' , cwd : __dirname }
99
99
) ;
100
100
101
- npmInstallProcess . stderr ?. pipe ( process . stderr ) ;
102
- npmInstallProcess . stdout ?. pipe ( process . stdout ) ;
101
+ inheritOutput && npmInstallProcess . stderr ?. pipe ( process . stderr ) ;
102
+ inheritOutput && npmInstallProcess . stdout ?. pipe ( process . stdout ) ;
103
+ inheritOutput && npmInstallProcess . on ( 'error' , ( e ) => console . error ( { e } ) ) ;
103
104
const exitCode : number = ( await once ( npmInstallProcess , 'exit' ) ) [ 0 ] ;
105
+ inheritOutput && console . error ( { exitCode } ) ;
106
+
104
107
if ( exitCode !== 0 ) {
105
108
throw new Error ( `unable to install module: ${ this . computedModuleName } @${ source } ` ) ;
106
109
}
Original file line number Diff line number Diff line change @@ -113,12 +113,12 @@ describe.only('common functionality', function () {
113
113
}
114
114
) ;
115
115
116
- context . only (
116
+ context (
117
117
'when given a correctly formatted git package using git tag that exists' ,
118
118
function ( ) {
119
119
it ( 'installs successfully' , async function ( ) {
120
120
const bson6Git = new Package ( 'bson#v6.0.0' ) ;
121
- const maybeError = await bson6Git . install ( ) . catch ( error => error ) ;
121
+ const maybeError = await bson6Git . install ( true ) . catch ( error => error ) ;
122
122
expect ( maybeError ) . to . be . undefined ;
123
123
} ) ;
124
124
}
You can’t perform that action at this time.
0 commit comments