Skip to content

Commit e70778f

Browse files
authored
Add more flexible SUITE_RUNNER_LOOKUP (#438)
Add SUITE_RUNNER_LOOKUP to dynamically look up the suite runner class
1 parent a64fa26 commit e70778f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

resources/benchmark-runner.mjs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,8 @@ export class BenchmarkRunner {
409409
async runSuite(suite) {
410410
// FIXME: Encapsulate more state in the SuiteRunner.
411411
// FIXME: Return and use measured values from SuiteRunner.
412-
const suiteRunner = new SuiteRunner(this._measuredValues, this._frame, this._page, this._client, suite);
412+
const suiteRunnerClass = SUITE_RUNNER_LOOKUP[suite.type ?? "default"];
413+
const suiteRunner = new suiteRunnerClass(this._measuredValues, this._frame, this._page, this._client, suite);
413414
await suiteRunner.run();
414415
}
415416

@@ -622,3 +623,12 @@ export class SuiteRunner {
622623
await this._client.didRunTest(this._suite, test);
623624
}
624625
}
626+
627+
// FIXME: implement remote steps
628+
class RemoteSuiteRunner extends SuiteRunner {}
629+
630+
const SUITE_RUNNER_LOOKUP = {
631+
__proto__: null,
632+
default: SuiteRunner,
633+
remote: RemoteSuiteRunner,
634+
};

0 commit comments

Comments
 (0)