@@ -74,25 +74,27 @@ const processDemo = async (demoName: string): Promise<DemoResult> => {
7474 }
7575 } ;
7676
77- const packageJSONPath = path . join ( demoDest , 'package.json' ) ;
78- const pkg = JSON . parse ( await fs . readFile ( packageJSONPath , 'utf-8' ) ) ;
79-
8077 // Run pnpm install and pnpm build
8178 try {
8279 execSync ( 'pnpm install' , { cwd : demoDest , stdio : 'inherit' } ) ;
8380 result . installResult . state = TestState . PASSED ;
8481 } catch ( ex ) {
82+ console . error ( 'Error installing packages: ' , ex ) ;
8583 result . installResult . state = TestState . FAILED ;
8684 result . installResult . error = ex . message ;
8785 return result ;
8886 }
8987
88+ const packageJSONPath = path . join ( demoDest , 'package.json' ) ;
89+ const pkg = JSON . parse ( await fs . readFile ( packageJSONPath , 'utf-8' ) ) ;
90+
9091 // Run pnpm clean for RN projects to avoid native build errors
9192 if ( pkg . scripts [ 'clean' ] ) {
9293 try {
93- execSync ( 'pnpm clean' , { cwd : demoDest , stdio : 'inherit' } ) ;
94+ execSync ( 'pnpm run clean' , { cwd : demoDest , stdio : 'inherit' } ) ;
9495 result . installResult . state = TestState . PASSED ;
9596 } catch ( ex ) {
97+ console . error ( 'Error running "pnpm run clean": ' , ex ) ;
9698 result . installResult . state = TestState . FAILED ;
9799 result . installResult . error = ex . message ;
98100 return result ;
@@ -112,6 +114,7 @@ const processDemo = async (demoName: string): Promise<DemoResult> => {
112114 execSync ( 'pnpm run test:build' , { cwd : demoDest , stdio : 'inherit' } ) ;
113115 result . buildResult . state = TestState . PASSED ;
114116 } catch ( ex ) {
117+ console . error ( 'Error running "pnpm run "test:build": ' , ex ) ;
115118 result . buildResult . state = TestState . FAILED ;
116119 result . buildResult . error = ex . message ;
117120 }
@@ -149,9 +152,10 @@ const main = async () => {
149152 process . exit ( 1 ) ;
150153 }
151154
152- const errored = ! ! results . find (
155+ const failed = results . filter (
153156 ( r ) => r . installResult . state == TestState . FAILED || r . buildResult . state == TestState . FAILED
154157 ) ;
158+ const errored = failed . length > 0 ;
155159
156160 console . log ( `Test results: \n${ JSON . stringify ( results , null , 2 ) } \n` ) ;
157161
@@ -168,7 +172,10 @@ const main = async () => {
168172 . write ( ) ;
169173
170174 if ( errored ) {
171- console . error ( `Some demos did not pass` ) ;
175+ console . error ( 'Some demos did not pass:' ) ;
176+ failed . forEach ( ( r ) =>
177+ console . error ( `- ${ r . name } (${ r . buildResult . state === TestState . FAILED ? 'build' : 'install' } )` )
178+ ) ;
172179 process . exit ( 1 ) ;
173180 } else {
174181 console . log ( 'All demos processed successfully.' ) ;
0 commit comments