@@ -63,6 +63,12 @@ describe('examples', () => {
63
63
await fs . writeFile ( path . join ( exampleTempDir , 'npm.stdout.log' ) , npmInstall . stdout ) ;
64
64
await fs . writeFile ( path . join ( exampleTempDir , 'npm.stderr.log' ) , npmInstall . stderr ) ;
65
65
} catch ( e ) {
66
+ try {
67
+ await fs . writeFile ( path . join ( exampleTempDir , 'npm.stdout.log' ) , npmInstall . stdout ) ;
68
+ await fs . writeFile ( path . join ( exampleTempDir , 'npm.stderr.log' ) , npmInstall . stderr ) ;
69
+ } catch ( e ) {
70
+ console . error ( 'failed to write logs to disk' , e ) ;
71
+ }
66
72
console . error ( `npm install failed in ${ exampleTempDir } ` , e ) ;
67
73
throw e ;
68
74
}
@@ -116,11 +122,16 @@ describe('examples', () => {
116
122
buildScript = await execa ( 'npm' , [ 'run' , 'build' ] , {
117
123
cwd : exampleTempDir ,
118
124
} ) ;
119
- await fs . writeFile ( path . join ( exampleTempDir , 'build.stdout.log' ) , buildScript . stdout ) ;
120
- await fs . writeFile ( path . join ( exampleTempDir , 'build.stderr.log' ) , buildScript . stderr ) ;
125
+
121
126
expect ( buildScript . stdout ) . toMatch ( 'Build completed' ) ;
122
127
expect ( buildScript . stderr ) . toBe ( '' ) ;
123
128
} catch ( e ) {
129
+ try {
130
+ await fs . writeFile ( path . join ( exampleTempDir , 'build.stdout.log' ) , buildScript . stdout ) ;
131
+ await fs . writeFile ( path . join ( exampleTempDir , 'build.stderr.log' ) , buildScript . stderr ) ;
132
+ } catch ( e ) {
133
+ console . error ( 'failed to write logs to disk' , e ) ;
134
+ }
124
135
console . error ( 'svite build failed' , e ) ;
125
136
throw e ;
126
137
}
0 commit comments