File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 16
16
*/
17
17
18
18
import { resolve } from 'path' ;
19
+ import { existsSync } from 'fs' ;
19
20
import { exec } from 'child-process-promise' ;
20
21
import chalk from 'chalk' ;
21
22
import simpleGit from 'simple-git/promise' ;
@@ -123,7 +124,15 @@ export async function getTestTasks(): Promise<TestTask[]> {
123
124
// Check for changed files inside package dirs.
124
125
const match = filename . match ( '^(packages(-exp)?/[a-zA-Z0-9-]+)/.*' ) ;
125
126
if ( match && match [ 1 ] ) {
126
- const changedPkg = require ( resolve ( root , match [ 1 ] , 'package.json' ) ) ;
127
+ const pkgJsonPath = resolve ( root , match [ 1 ] , 'package.json' ) ;
128
+
129
+ // skip projects that don't have package.json
130
+ // It could happen when we rename a package or remove a package from the repo
131
+ if ( ! existsSync ( pkgJsonPath ) ) {
132
+ continue ;
133
+ }
134
+
135
+ const changedPkg = require ( pkgJsonPath ) ;
127
136
if ( changedPkg ) {
128
137
const changedPkgName = changedPkg . name ;
129
138
const task = testTasks . find ( t => t . pkgName === changedPkgName ) ;
You can’t perform that action at this time.
0 commit comments