From acda96220598096be4d427705cbb57227a8d014e Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Thu, 8 Oct 2020 10:42:35 +0200 Subject: [PATCH] Remove unnecessary wrappers --- scripts/benchmark.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/scripts/benchmark.js b/scripts/benchmark.js index e7593b428759ab..b13e9eb830bfd0 100644 --- a/scripts/benchmark.js +++ b/scripts/benchmark.js @@ -41,12 +41,9 @@ 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(), }; } @@ -54,7 +51,7 @@ 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; @@ -62,7 +59,7 @@ async function runMeasures(browser, testCase, times) { }); measures.push(benchmark); - await close(); + await page.close(); } return measures;