1
0
mirror of https://github.com/theoludwig/programming-challenges.git synced 2025-12-11 00:21:24 +01:00

fix(cli): changes to templates/docker, should run all affected tests

This commit is contained in:
Divlo
2021-11-09 16:45:42 +01:00
parent 9621751a4d
commit 17efe8a113
10 changed files with 1241 additions and 1209 deletions

View File

@@ -29,6 +29,8 @@ export interface TestOptions {
elapsedTimeMilliseconds: number
}
export const successMessage = `${chalk.bold.green('Success:')} Tests passed! 🎉`
export class Test implements TestOptions {
public index: number
public path: string
@@ -132,6 +134,23 @@ export class Test implements TestOptions {
return { input, output }
}
static async runManyWithSolutions (solutions: Solution[]): Promise<number> {
for (const solution of solutions) {
await solution.test()
console.log('\n------------------------------\n')
}
console.log(successMessage)
return 0
}
static async runAllTests (programmingLanguage?: string): Promise<number> {
const solutions = await Solution.getManyByProgrammingLanguages(
programmingLanguage != null ? [programmingLanguage] : undefined
)
await Test.runManyWithSolutions(solutions)
return 0
}
static async run (options: TestRunOptions): Promise<Test> {
const { input, output } = await Test.getInputOutput(options.path)
const start = performance.now()