From 99d5290e49e9c1a8571aacb827d29b5287a08b0e Mon Sep 17 00:00:00 2001 From: Divlo Date: Fri, 25 Jun 2021 13:02:34 +0200 Subject: [PATCH] fix(cli): improve error handling in `run test` command --- .github/workflows/ci.yml | 2 ++ cli/services/GitAffected.ts | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a6326d..f5ec1ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,6 +81,8 @@ jobs: runs-on: 'ubuntu-latest' steps: - uses: 'actions/checkout@v2' + with: + fetch-depth: 0 - name: 'Use Docker' uses: 'actions-hub/docker/cli@master' diff --git a/cli/services/GitAffected.ts b/cli/services/GitAffected.ts index 3eb7bfc..20d783a 100644 --- a/cli/services/GitAffected.ts +++ b/cli/services/GitAffected.ts @@ -29,10 +29,14 @@ export class GitAffected implements GitAffectedOptions { base: string, head: string ): Promise { - const { stdout } = await execa.command( - `git diff --name-only --relative ${base} ${head}` - ) - return this.parseGitOutput(stdout) + try { + const { stdout } = await execa.command( + `git diff --name-only --relative ${base} ${head}` + ) + return this.parseGitOutput(stdout) + } catch { + return [] + } } public async getUncommittedFiles (): Promise {