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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user