1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2024-11-09 22:08:58 +01:00

fix(cli): don't run tests for removed solutions

This commit is contained in:
Divlo 2021-09-30 19:08:50 +02:00
parent 9ae0cadb72
commit a9287a87fe
No known key found for this signature in database
GPG Key ID: 6F24DA54DA3967CF

View File

@ -2,6 +2,7 @@ import execa from 'execa'
import { Challenge } from './Challenge' import { Challenge } from './Challenge'
import { Solution } from './Solution' import { Solution } from './Solution'
import { isExistingPath } from '../utils/isExistingPath'
const solutionsRegex = new RegExp( 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)/ /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) => { const affectedSolutionsPaths = files.filter((filePath) => {
return solutionsRegex.test(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] = const [, challengeName, , programmingLanguageName, solutionName] =
solution.split('/') solution.split('/')
return new Solution({ return new Solution({