Skip to content

Commit

Permalink
Add more flexible SUITE_RUNNER_LOOKUP (#438)
Browse files Browse the repository at this point in the history
Add SUITE_RUNNER_LOOKUP to dynamically look up the suite runner class
  • Loading branch information
camillobruni authored Nov 13, 2024
1 parent a64fa26 commit e70778f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion resources/benchmark-runner.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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,
};

0 comments on commit e70778f

Please sign in to comment.