@@ -63,41 +63,36 @@ async function buildForTests(
6363 config : TestConfig ,
6464 { buildAll = false } : Options
6565) {
66- try {
67- const testTasks = filterTasks ( await getTestTasks ( ) , config ) ;
68- // print tasks for info
69- logTasks ( testTasks ) ;
70- if ( testTasks . length === 0 ) {
71- console . log ( chalk `{green No test tasks. Skipping all builds }` ) ;
72- return ;
73- }
66+ const testTasks = filterTasks ( await getTestTasks ( ) , config ) ;
67+ // print tasks for info
68+ logTasks ( testTasks ) ;
69+ if ( testTasks . length === 0 ) {
70+ console . log ( chalk `{green No test tasks. Skipping all builds }` ) ;
71+ return ;
72+ }
7473
75- // build all and return
76- if ( buildAll ) {
77- await spawn ( 'yarn' , [ 'build' ] , { stdio : 'inherit' , cwd : root } ) ;
78- return ;
79- }
74+ // build all and return
75+ if ( buildAll ) {
76+ await spawn ( 'yarn' , [ 'build' ] , { stdio : 'inherit' , cwd : root } ) ;
77+ return ;
78+ }
8079
81- const lernaCmd = [ 'lerna' , 'run' ] ;
82- console . log ( chalk `{blue Running build in:}` ) ;
83- for ( const task of testTasks ) {
84- if ( task . reason === TestReason . Changed ) {
85- console . log ( chalk `{yellow ${ task . pkgName } (contains modified files)}` ) ;
86- } else if ( task . reason === TestReason . Dependent ) {
87- console . log (
88- chalk `{yellow ${ task . pkgName } (depends on modified files)}`
89- ) ;
90- } else {
91- console . log ( chalk `{yellow ${ task . pkgName } (running all tests)}` ) ;
92- }
93- lernaCmd . push ( '--scope' ) ;
94- lernaCmd . push ( task . pkgName ) ;
80+ const lernaCmd = [ 'lerna' , 'run' ] ;
81+ console . log ( chalk `{blue Running build in:}` ) ;
82+ for ( const task of testTasks ) {
83+ if ( task . reason === TestReason . Changed ) {
84+ console . log ( chalk `{yellow ${ task . pkgName } (contains modified files)}` ) ;
85+ } else if ( task . reason === TestReason . Dependent ) {
86+ console . log (
87+ chalk `{yellow ${ task . pkgName } (depends on modified files)}`
88+ ) ;
89+ } else {
90+ console . log ( chalk `{yellow ${ task . pkgName } (running all tests)}` ) ;
9591 }
96-
97- lernaCmd . push ( '--include-dependencies' , 'build' ) ;
98- await spawn ( 'npx' , lernaCmd , { stdio : 'inherit' , cwd : root } ) ;
99- } catch ( e ) {
100- console . error ( chalk `{red ${ e } }` ) ;
101- process . exit ( 1 ) ;
92+ lernaCmd . push ( '--scope' ) ;
93+ lernaCmd . push ( task . pkgName ) ;
10294 }
95+
96+ lernaCmd . push ( '--include-dependencies' , 'build' ) ;
97+ await spawn ( 'npx' , lernaCmd , { stdio : 'inherit' , cwd : root } ) ;
10398}
0 commit comments