Skip to content

Commit

Permalink
fix: error handling on list-files (#441)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt authored Mar 15, 2024
1 parent 75a2022 commit f92ad70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/playwrightTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,12 @@ export class PlaywrightTest {
this._log(`${escapeRegex(path.relative(config.workspaceFolder, configFolder))}> playwright list-files -c ${configFile}`);
}
const output = await this._runNode(allArgs, configFolder);
const result = JSON.parse(output) as ConfigListFilesReport;
return result;
const result = JSON.parse(output) as Partial<ConfigListFilesReport>;
return {
// list-files does not return `projects: []` if there is an error.
projects: [],
...result,
};
}

private async _listFilesServer(config: TestConfig): Promise<ConfigListFilesReport> {
Expand Down
3 changes: 2 additions & 1 deletion src/testModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,8 @@ export class TestModelCollection extends DisposableBase {
firstProject = false;
}
} else {
model.projects()[0].isEnabled = true;
if (model.projects().length)
model.projects()[0].isEnabled = true;
}
}

Expand Down

0 comments on commit f92ad70

Please sign in to comment.