Use more performance.mark for suites (#154)
- Use more performance.mark for whole suites. - Pre-build the mark strings upfront
This commit is contained in:
parent
373580bec9
commit
ac59c3fb1e
2 changed files with 14 additions and 5 deletions
|
|
@ -190,11 +190,19 @@ export class BenchmarkRunner {
|
|||
}
|
||||
|
||||
async _runSuite(suite) {
|
||||
const suitePrepareLabel = `suite-${suite.name}-prepare`;
|
||||
const suiteStartLabel = `suite-${suite.name}-start`;
|
||||
const suiteEndLabel = `suite-${suite.name}-end`;
|
||||
|
||||
performance.mark(suitePrepareLabel);
|
||||
await this._prepareSuite(suite);
|
||||
performance.mark(`start-suite-${suite.name}`);
|
||||
|
||||
performance.mark(suiteStartLabel);
|
||||
for (const test of suite.tests)
|
||||
await this._runTestAndRecordResults(suite, test);
|
||||
performance.mark(`end-suite-${suite.name}`);
|
||||
performance.mark(suiteEndLabel);
|
||||
|
||||
performance.measure(`suite-${suite.name}`, suiteStartLabel, suiteEndLabel);
|
||||
}
|
||||
|
||||
async _prepareSuite(suite) {
|
||||
|
|
|
|||
|
|
@ -167,9 +167,10 @@ describe("BenchmarkRunner", () => {
|
|||
|
||||
it("should run and record results for every test in suite", async () => {
|
||||
assert.calledThrice(_runTestAndRecordResultsStub);
|
||||
assert.calledWith(peformanceMarkSpy, "start-suite-Suite 1");
|
||||
assert.calledWith(peformanceMarkSpy, "end-suite-Suite 1");
|
||||
expect(peformanceMarkSpy.callCount).to.equal(2);
|
||||
assert.calledWith(peformanceMarkSpy, "suite-Suite 1-prepare");
|
||||
assert.calledWith(peformanceMarkSpy, "suite-Suite 1-start");
|
||||
assert.calledWith(peformanceMarkSpy, "suite-Suite 1-end");
|
||||
expect(peformanceMarkSpy.callCount).to.equal(3);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue