From a9287a87fe618b2ca818c91b5f6add139216b4ae Mon Sep 17 00:00:00 2001 From: Divlo Date: Thu, 30 Sep 2021 19:08:50 +0200 Subject: [PATCH] fix(cli): don't run tests for removed solutions --- cli/services/GitAffected.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cli/services/GitAffected.ts b/cli/services/GitAffected.ts index cf03b93..8aff6a8 100644 --- a/cli/services/GitAffected.ts +++ b/cli/services/GitAffected.ts @@ -2,6 +2,7 @@ import execa from 'execa' import { Challenge } from './Challenge' import { Solution } from './Solution' +import { isExistingPath } from '../utils/isExistingPath' const solutionsRegex = new RegExp( /challenges\/[\s\S]*\/solutions\/(c|cpp|cs|dart|java|javascript|python|rust|typescript)\/[\s\S]*\/(solution|Solution).(c|cpp|cs|dart|java|js|py|rs|ts)/ @@ -71,7 +72,13 @@ export class GitAffected implements GitAffectedOptions { const affectedSolutionsPaths = files.filter((filePath) => { return solutionsRegex.test(filePath) }) - return affectedSolutionsPaths.map((solution) => { + const solutions: string[] = [] + for (const path of affectedSolutionsPaths) { + if (await isExistingPath(path)) { + solutions.push(path) + } + } + return solutions.map((solution) => { const [, challengeName, , programmingLanguageName, solutionName] = solution.split('/') return new Solution({