mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-01 10:16:07 -06:00
31 lines
808 B
TypeScript
31 lines
808 B
TypeScript
import { IFrontendTesting, ITestable } from './frontend-testing.interfaces';
|
|
|
|
class FrontendTesting implements IFrontendTesting {
|
|
private testSuites: Array<ITestable> = [];
|
|
|
|
public add(test: ITestable) {
|
|
this.testSuites.push(test);
|
|
}
|
|
|
|
public getAllTestNames(): string[] {
|
|
return this.testSuites.map((val) => val.description);
|
|
}
|
|
|
|
private findTest(name: string) {
|
|
for (const suite of this.testSuites) {
|
|
if (suite.description === name) {
|
|
return suite;
|
|
}
|
|
}
|
|
|
|
throw new Error(`Can't find test ${name}`);
|
|
}
|
|
|
|
public async run(testToRun: string) {
|
|
const testSuite = this.findTest(testToRun);
|
|
await testSuite.run();
|
|
}
|
|
}
|
|
|
|
window.compilerExplorerFrontendTesting = new FrontendTesting();
|