Skip to content

Commit

Permalink
Remove unnecessary wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Oct 8, 2020
1 parent 1446315 commit acda962
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions scripts/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,25 @@ async function createBrowser() {
const page = await browser.newPage();
await page.goto(url);

return {
page,
close: () => page.close(),
};
return page;
},
close: async () => browser.close(),
close: () => browser.close(),
};
}

async function runMeasures(browser, testCase, times) {
const measures = [];

for (let i = 0; i < times; i += 1) {
const { page, close } = await browser.openPage(`http://localhost:${PORT}/${APP}?${testCase}`);
const page = await browser.openPage(`http://localhost:${PORT}/${APP}?${testCase}`);

const benchmark = await page.evaluate(() => {
const { loadEventEnd, navigationStart } = performance.timing;
return loadEventEnd - navigationStart;
});

measures.push(benchmark);
await close();
await page.close();
}

return measures;
Expand Down

0 comments on commit acda962

Please sign in to comment.