Skip to content

Commit fa412bd

Browse files
committed
skip deleted projects
1 parent ca7f425 commit fa412bd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

scripts/ci-test/tasks.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717

1818
import { resolve } from 'path';
19+
import { existsSync } from 'fs';
1920
import { exec } from 'child-process-promise';
2021
import chalk from 'chalk';
2122
import simpleGit from 'simple-git/promise';
@@ -123,7 +124,15 @@ export async function getTestTasks(): Promise<TestTask[]> {
123124
// Check for changed files inside package dirs.
124125
const match = filename.match('^(packages(-exp)?/[a-zA-Z0-9-]+)/.*');
125126
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);
127136
if (changedPkg) {
128137
const changedPkgName = changedPkg.name;
129138
const task = testTasks.find(t => t.pkgName === changedPkgName);

0 commit comments

Comments
 (0)