Add more flexible SUITE_RUNNER_LOOKUP (#438)

Add SUITE_RUNNER_LOOKUP to dynamically look up the suite runner class
This commit is contained in:
Camillo Bruni 2024-11-13 13:30:47 +01:00 committed by GitHub
parent a64fa26876
commit e70778f1a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -409,7 +409,8 @@ export class BenchmarkRunner {
async runSuite(suite) {
// FIXME: Encapsulate more state in the SuiteRunner.
// FIXME: Return and use measured values from SuiteRunner.
const suiteRunner = new SuiteRunner(this._measuredValues, this._frame, this._page, this._client, suite);
const suiteRunnerClass = SUITE_RUNNER_LOOKUP[suite.type ?? "default"];
const suiteRunner = new suiteRunnerClass(this._measuredValues, this._frame, this._page, this._client, suite);
await suiteRunner.run();
}
@ -622,3 +623,12 @@ export class SuiteRunner {
await this._client.didRunTest(this._suite, test);
}
}
// FIXME: implement remote steps
class RemoteSuiteRunner extends SuiteRunner {}
const SUITE_RUNNER_LOOKUP = {
__proto__: null,
default: SuiteRunner,
remote: RemoteSuiteRunner,
};