File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,15 @@ const pkgjson = JSON.parse(fs.readFileSync('package.json'));
11
11
12
12
const DOWNSTREAMS_PATH = path . resolve ( PKG_DIR , 'downstream_projects' ) ;
13
13
const UPSTREAM_PKGS = ( process . env . UPSTREAM_PKGS || '' ) . split ( ',' ) . filter ( x => x ) . concat ( pkgjson . name ) ;
14
+ const DOWNSTREAM_PKGS = ( process . env . DOWNSTREAM_PKGS || '' ) . split ( ',' ) . filter ( x => x ) ;
14
15
15
16
function forEachDownstream ( callback ) {
16
17
Object . keys ( config ) . forEach ( key => {
18
+ if ( DOWNSTREAM_PKGS . length && DOWNSTREAM_PKGS . indexOf ( key ) === - 1 ) {
19
+ console . log ( key + ' not in DOWNSTREAM_PKGS, skipping...' ) ;
20
+ return ;
21
+ }
22
+
17
23
const projectPath = path . resolve ( DOWNSTREAMS_PATH , key ) ;
18
24
if ( ! fs . existsSync ( projectPath ) ) {
19
25
process . chdir ( DOWNSTREAMS_PATH ) ;
@@ -60,6 +66,13 @@ function installDeps() {
60
66
61
67
function runTests ( ) {
62
68
util . _exec ( `UPSTREAM_PKGS="${ UPSTREAM_PKGS . join ( ',' ) } " npm test` ) ;
69
+
70
+ const downstreamPkgJson = JSON . parse ( fs . readFileSync ( 'package.json' ) ) ;
71
+ const hasDownstreamTests = downstreamPkgJson . scripts && ! ! downstreamPkgJson . scripts [ 'test:downstream' ] ;
72
+
73
+ if ( hasDownstreamTests ) {
74
+ util . _exec ( `UPSTREAM_PKGS="${ UPSTREAM_PKGS . join ( ',' ) } " npm run test:downstream` ) ;
75
+ }
63
76
}
64
77
65
78
makeWorkingCopy ( ) ;
You can’t perform that action at this time.
0 commit comments