Add more flexible SUITE_RUNNER_LOOKUP (#438)
Add SUITE_RUNNER_LOOKUP to dynamically look up the suite runner class
This commit is contained in:
parent
a64fa26876
commit
e70778f1a8
1 changed files with 11 additions and 1 deletions
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue