diff --git a/lib/plugins/browsertime/analyzer.js b/lib/plugins/browsertime/analyzer.js index 90bbd971b..92cf5c9af 100644 --- a/lib/plugins/browsertime/analyzer.js +++ b/lib/plugins/browsertime/analyzer.js @@ -51,9 +51,9 @@ function addExtraScripts(scriptsByCategory, pluginScripts) { } function setupAsynScripts(asyncScripts) { - var allAsyncScripts = {}; + const allAsyncScripts = {}; // For all different script in the array - for (var scripts of asyncScripts) { + for (let scripts of asyncScripts) { // and then for all scripts in that category forEach(scripts.scripts, function(script, name) { set(allAsyncScripts, scripts.category + '.' + name, script); diff --git a/lib/plugins/budget/verify.js b/lib/plugins/budget/verify.js index 0d6886e1b..4b91122c5 100644 --- a/lib/plugins/budget/verify.js +++ b/lib/plugins/budget/verify.js @@ -35,7 +35,7 @@ module.exports = { const working = []; // do we have an entry in the budget for this kind of message? if (budgets[message.type]) { - for (var budget of budgets[message.type]) { + for (let budget of budgets[message.type]) { let value = get(message.data, budget.metric); if (value !== undefined) { diff --git a/lib/plugins/html/setup/detailed.js b/lib/plugins/html/setup/detailed.js index 7332f3d80..5aba588a8 100644 --- a/lib/plugins/html/setup/detailed.js +++ b/lib/plugins/html/setup/detailed.js @@ -143,7 +143,7 @@ module.exports = function(data) { } if (summary.custom) { - for (var key of Object.keys(summary.custom)) { + for (let key of Object.keys(summary.custom)) { rows.push(row(summary.custom[key], key)); } } diff --git a/lib/plugins/html/setup/summaryBoxes.js b/lib/plugins/html/setup/summaryBoxes.js index 95db0ca8c..dadd6dfcb 100644 --- a/lib/plugins/html/setup/summaryBoxes.js +++ b/lib/plugins/html/setup/summaryBoxes.js @@ -257,7 +257,7 @@ module.exports = function(data) { } if (summary.custom) { - for (var key of Object.keys(summary.custom)) { + for (let key of Object.keys(summary.custom)) { boxes.push(infoBox(summary.custom[key], key)); } } diff --git a/lib/plugins/html/templates/index.pug b/lib/plugins/html/templates/index.pug index 7330fe1bc..431a82e25 100644 --- a/lib/plugins/html/templates/index.pug +++ b/lib/plugins/html/templates/index.pug @@ -18,7 +18,7 @@ block content each rows in boxes .row each box in rows - - var length = rows.length + - const length = rows.length case length when 3 .one-third.column diff --git a/lib/plugins/html/templates/runInfo.pug b/lib/plugins/html/templates/runInfo.pug index 0120a3eb7..eb23df0fd 100644 --- a/lib/plugins/html/templates/runInfo.pug +++ b/lib/plugins/html/templates/runInfo.pug @@ -1,5 +1,5 @@ -- var profile = options.mobile ? 'mobile' : 'desktop' +- const profile = options.mobile ? 'mobile' : 'desktop' h2.url #{h.plural(noPages,'page')} analyzed for #{h.short(context.name, 30)} p.small Tested #{timestamp} using #{h.cap(options.browsertime.browser)} for | #{ h.get(options, 'browsertime.chrome.android.package') ? h.get(options, 'browsertime.chrome.android.package') + ' ': ''} diff --git a/lib/plugins/html/templates/toplist.pug b/lib/plugins/html/templates/toplist.pug index 710a9577d..d9db3731d 100644 --- a/lib/plugins/html/templates/toplist.pug +++ b/lib/plugins/html/templates/toplist.pug @@ -18,8 +18,8 @@ block content include runInfo if (assetsBySize) - - var topLists = ['javascript', 'image', 'css', 'html']; - - var contentTypeNames = {javascript: 'JavaScript', image: 'image' , css: 'CSS', html : 'HTML'} + - const topLists = ['javascript', 'image', 'css', 'html']; + - const contentTypeNames = {javascript: 'JavaScript', image: 'image' , css: 'CSS', html : 'HTML'} ul li.group-item.active Quick links each type in topLists diff --git a/lib/plugins/html/templates/url/coach/index.pug b/lib/plugins/html/templates/url/coach/index.pug index aa5015c03..56e43372e 100644 --- a/lib/plugins/html/templates/url/coach/index.pug +++ b/lib/plugins/html/templates/url/coach/index.pug @@ -27,7 +27,7 @@ mixin adviceInfo(name, perfectScore, node) else p #{perfectScore} -- var advice = pageInfo.data.coach.run ? pageInfo.data.coach.run.advice : pageInfo.data.coach.pageSummary.advice; +- const advice = pageInfo.data.coach.run ? pageInfo.data.coach.run.advice : pageInfo.data.coach.pageSummary.advice; h2 Coach p.small @@ -36,9 +36,9 @@ p.small script(type='text/javascript'). function toggleRow(toggleElement) { - var rows = toggleElement.nextSibling.getElementsByClassName("u-hideable"); - for (var i = 0; i < rows.length; ++i) { - var status = rows[i].currentStyle ? rows[i].currentStyle.display : + const rows = toggleElement.nextSibling.getElementsByClassName("u-hideable"); + for (let i = 0; i < rows.length; ++i) { + const status = rows[i].currentStyle ? rows[i].currentStyle.display : getComputedStyle(rows[i], null).display; rows[i].style.display = (status === 'none') ? "table-row" : "none"; } diff --git a/lib/plugins/html/templates/url/includes/pageRunInfo.pug b/lib/plugins/html/templates/url/includes/pageRunInfo.pug index bf287c07c..587a1eb6d 100644 --- a/lib/plugins/html/templates/url/includes/pageRunInfo.pug +++ b/lib/plugins/html/templates/url/includes/pageRunInfo.pug @@ -1,5 +1,5 @@ -- var profile = options.mobile ? 'mobile' : 'desktop' -- var runTime = h.get(pageInfo, 'pageInfo.data.browsertime.run.timestamp', timestamp) +- const profile = options.mobile ? 'mobile' : 'desktop' +- const runTime = h.get(pageInfo, 'pageInfo.data.browsertime.run.timestamp', timestamp) p.small Tested #{runTime} using #{h.cap(options.browsertime.browser)} #{browser.version} for | #{ h.get(options, 'browsertime.chrome.android.package') ? ' ' + h.get(options, 'browsertime.chrome.android.package') + ' ': ''} | #{options.preURL ? 'preURL ' + h.short(options.preURL, 60) + ' ': ''} diff --git a/lib/plugins/html/templates/url/iteration/downloads.pug b/lib/plugins/html/templates/url/iteration/downloads.pug index ca9578930..e5a38b540 100644 --- a/lib/plugins/html/templates/url/iteration/downloads.pug +++ b/lib/plugins/html/templates/url/iteration/downloads.pug @@ -1,11 +1,11 @@ if options.browsertime.video - - var videoPath = 'data/video/' + (iteration ? iteration : 1) +'.mp4' + - const videoPath = 'data/video/' + (iteration ? iteration : 1) +'.mp4' a.button.button-download(href=videoPath, download=downloadName + '-video.mp4') Download video if options.browsertime.chrome && options.browsertime.chrome.timeline - - var tracePath = 'data/trace-' + (iteration ? iteration : 1) + '.json.gz' + - const tracePath = 'data/trace-' + (iteration ? iteration : 1) + '.json.gz' a.button.button-download(href=tracePath, download=downloadName + '-timeline.json.gz') Download timeline if d.browsertime && d.browsertime.har - - var harEnding = options.gzipHAR ? '.har.gz' : '.har' - - var harName = 'data/browsertime' + harEnding - - var harDownloadName = downloadName + harEnding + - const harEnding = options.gzipHAR ? '.har.gz' : '.har' + - const harName = 'data/browsertime' + harEnding + - const harDownloadName = downloadName + harEnding a.button.button-download(href=harName, download=harDownloadName) Download HAR diff --git a/lib/plugins/html/templates/url/iteration/index.pug b/lib/plugins/html/templates/url/iteration/index.pug index 59608f0c0..64bd813fd 100644 --- a/lib/plugins/html/templates/url/iteration/index.pug +++ b/lib/plugins/html/templates/url/iteration/index.pug @@ -1,10 +1,10 @@ extends ../../layout.pug block content - - var d = pageInfo.data + - const d = pageInfo.data - runNumber = iteration - - var daTitle = daurlAlias ? daurlAlias : daurl - - var downloadName = (daTitle + '-' + runNumber + '-' + options.browser + '-' + timestamp).replace(/(https?\:\/\/)|( )|(:)/ig, '') + - const daTitle = daurlAlias ? daurlAlias : daurl + - const downloadName = (daTitle + '-' + runNumber + '-' + options.browser + '-' + timestamp).replace(/(https?\:\/\/)|( )|(:)/ig, '') h1 Run #{runNumber} summary h5.url @@ -104,7 +104,7 @@ block content img.screenshot(src=screenshotName, alt='Screenshot') else if hasScreenShots - screenshotName = 'data/screenshots/' + iteration + '.' + screenShotType - - var width = options.mobile ? 150 : '100%'; + - const width = options.mobile ? 150 : '100%'; a(href=screenshotName) img.screenshot(src=screenshotName, width=width, alt='Screenshot') .downloads @@ -130,6 +130,6 @@ block content include ../pagexray/index.pug each pageRun in pageRuns - - var panelName = pageRun.id + '-panel' + - const panelName = pageRun.id + '-panel' section(id=panelName) p !{pugs[pageRun.id]} diff --git a/lib/plugins/html/templates/url/metrics/index.pug b/lib/plugins/html/templates/url/metrics/index.pug index 235ea56ae..f46ac68e7 100644 --- a/lib/plugins/html/templates/url/metrics/index.pug +++ b/lib/plugins/html/templates/url/metrics/index.pug @@ -1,8 +1,8 @@ -- var browsertime = medianRun ? pageInfo.data.browsertime.pageSummary.browserScripts[medianRun.runIndex - 1] : pageInfo.data.browsertime.run +- const browsertime = medianRun ? pageInfo.data.browsertime.pageSummary.browserScripts[medianRun.runIndex - 1] : pageInfo.data.browsertime.run if browsertime - - var timings = browsertime.timings; - - var visualMetrics = browsertime.visualMetrics; + - const timings = browsertime.timings; + - const visualMetrics = browsertime.visualMetrics; - baseHelpURL = rootPath + 'help.html#'; if options.browsertime.visualMetrics && visualMetrics @@ -131,7 +131,7 @@ if browsertime .downloads if options.browsertime.chrome && options.browsertime.chrome.timeline - - var tracePath = 'data/trace-' + (runNumber? runNumber : 1) + '.json.gz' + - const tracePath = 'data/trace-' + (runNumber? runNumber : 1) + '.json.gz' a.button.button-download(href=tracePath, download=downloadName + '-timeline.json.gz') Download timeline if options.browsertime.visualElements a#visual-elements diff --git a/lib/plugins/html/templates/url/metrics/visualProgress.pug b/lib/plugins/html/templates/url/metrics/visualProgress.pug index 25aff463c..d63f60a66 100644 --- a/lib/plugins/html/templates/url/metrics/visualProgress.pug +++ b/lib/plugins/html/templates/url/metrics/visualProgress.pug @@ -1,11 +1,11 @@ -- var allRows = browsertime.visualMetrics.VisualProgress.split(',') -- var seriesVisualProgress = []; -- var oldPercent = -1; -- var oldValue = -1; +- const allRows = browsertime.visualMetrics.VisualProgress.split(',') +- const seriesVisualProgress = []; +- const oldPercent = -1; +- const oldValue = -1; each eachRow in allRows - - var row = eachRow.split('=') - - var newValue = (Number(row[0])/1000).toFixed(1) - - var percent = row[1] + - const row = eachRow.split('=') + - const newValue = (Number(row[0])/1000).toFixed(1) + - const percent = row[1] //- Sometimes VisualMetrics report the same percentage multiple times after each other // and since the original time is in ms we wanna remove entries on the same 0.1 s if percent !== oldPercent && newValue !== oldValue @@ -14,7 +14,7 @@ each eachRow in allRows - seriesVisualProgress.push({x: newValue, y: Number(percent.replace('%',''))}) script(type='text/javascript'). document.addEventListener("DOMContentLoaded", function() { - var visualProgressChart = new Chartist.Line('#ct-visualprogress', { + const visualProgressChart = new Chartist.Line('#ct-visualprogress', { series: [!{JSON.stringify(seriesVisualProgress)}], }, { showArea: true, @@ -60,7 +60,7 @@ script(type='text/javascript'). }), Chartist.plugins.tooltip({ transformTooltipTextFnc: function(text) { - var m = text.split(','); + const m = text.split(','); return m[0] + 's ' + m[1] + '%'; } }) diff --git a/lib/plugins/html/templates/url/pagexray/index.pug b/lib/plugins/html/templates/url/pagexray/index.pug index 6b4f7fc51..a58612c66 100644 --- a/lib/plugins/html/templates/url/pagexray/index.pug +++ b/lib/plugins/html/templates/url/pagexray/index.pug @@ -2,7 +2,7 @@ include ../../_tableMixins a h2 PageXray -- var pagexray = pageInfo.data.pagexray.run || pageInfo.data.pagexray.pageSummary; +- const pagexray = pageInfo.data.pagexray.run || pageInfo.data.pagexray.pageSummary; p.small Hard facts about the page. a#pagexray-summary .row diff --git a/lib/plugins/html/templates/url/summary/downloads.pug b/lib/plugins/html/templates/url/summary/downloads.pug index e371af172..63dc6d4e1 100644 --- a/lib/plugins/html/templates/url/summary/downloads.pug +++ b/lib/plugins/html/templates/url/summary/downloads.pug @@ -1,13 +1,13 @@ if options.html.logDownloadLink a.button.button-download(href=rootPath + 'logs/sitespeed.io.log', download) Download run log if options.browsertime.video - - var videoPath = 'data/video/' + (runIndex ? (Number(runIndex)+1) : 1) +'.mp4' + - const videoPath = 'data/video/' + (runIndex ? (Number(runIndex)+1) : 1) +'.mp4' a.button.button-download(href=videoPath, download=downloadName + '-video.mp4') Download video if options.browsertime.chrome && options.browsertime.chrome.timeline - - var tracePath = 'data/trace-' + (runNumber? runNumber : 1) + '.json.gz' + - const tracePath = 'data/trace-' + (runNumber? runNumber : 1) + '.json.gz' a.button.button-download(href=tracePath, download=downloadName + '-timeline.json.gz') Download timeline if d.browsertime && d.browsertime.har - - var harEnding = options.gzipHAR ? '.har.gz' : '.har' - - var harName = 'data/browsertime' + harEnding - - var harDownloadName = downloadName + harEnding + - const harEnding = options.gzipHAR ? '.har.gz' : '.har' + - const harName = 'data/browsertime' + harEnding + - const harDownloadName = downloadName + harEnding a.button.button-download(href=harName, download=harDownloadName) Download HAR diff --git a/lib/plugins/html/templates/url/summary/index.pug b/lib/plugins/html/templates/url/summary/index.pug index 4494cc87c..676546b55 100644 --- a/lib/plugins/html/templates/url/summary/index.pug +++ b/lib/plugins/html/templates/url/summary/index.pug @@ -1,9 +1,9 @@ extends ./layout.pug block content - - var d = pageInfo.data - - var daTitle = daurlAlias ? daurlAlias : daurl - - var downloadName = (daTitle + '-' + options.browser + '-' + timestamp).replace(/(https?\:\/\/)|( )|(:)/ig, '') + - const d = pageInfo.data + - const daTitle = daurlAlias ? daurlAlias : daurl + - const downloadName = (daTitle + '-' + options.browser + '-' + timestamp).replace(/(https?\:\/\/)|( )|(:)/ig, '') h1 Page summary h5.url @@ -94,9 +94,9 @@ block content .one-half.column if hasScreenShots - - var width = options.mobile ? 150 : '100%'; - - var screenshotNo = medianRun ? medianRun.runIndex : 1 - - var screenshotName = 'data/screenshots/' + screenshotNo + '.' + screenShotType + - const width = options.mobile ? 150 : '100%'; + - const screenshotNo = medianRun ? medianRun.runIndex : 1 + - const screenshotName = 'data/screenshots/' + screenshotNo + '.' + screenShotType a(href=screenshotName) img.screenshot(src=screenshotName, width=width, alt='Screenshot of run ' + screenshotNo) else if !d.browsertime && d.webpagetest @@ -128,6 +128,6 @@ block content include ../pagexray/index.pug each pageSummary in pageSummaries - - var panelName = pageSummary.id + '-panel' + - const panelName = pageSummary.id + '-panel' section(id=panelName) p !{pugs[pageSummary.id]} diff --git a/lib/plugins/html/templates/url/video/index.pug b/lib/plugins/html/templates/url/video/index.pug index a4e287164..5a31673ae 100644 --- a/lib/plugins/html/templates/url/video/index.pug +++ b/lib/plugins/html/templates/url/video/index.pug @@ -1,5 +1,5 @@ -- var videoIndex = medianRun ? medianRun.runIndex : iteration; -- var width = options.mobile ? 'max-width: 400px;' : h.get(options, 'browsertime.chrome.android.package') ? 'max-width: 400px;' : 'width: 100%' +- const videoIndex = medianRun ? medianRun.runIndex : iteration; +- const width = options.mobile ? 'max-width: 400px;' : h.get(options, 'browsertime.chrome.android.package') ? 'max-width: 400px;' : 'width: 100%' a#video h3 Video @@ -10,5 +10,5 @@ h3 Video script(src= rootPath + 'js/video.novtt.min.js') -- var videoPath = 'data/video/' + (iteration ? iteration : medianRun.runIndex ) +'.mp4' +- const videoPath = 'data/video/' + (iteration ? iteration : medianRun.runIndex ) +'.mp4' a.button.button-download(href=videoPath, download=downloadName + '-video.mp4') Download video diff --git a/lib/plugins/html/templates/url/waterfall/fetchHAR.pug b/lib/plugins/html/templates/url/waterfall/fetchHAR.pug index 9f6707a5a..3cff7baf7 100644 --- a/lib/plugins/html/templates/url/waterfall/fetchHAR.pug +++ b/lib/plugins/html/templates/url/waterfall/fetchHAR.pug @@ -2,10 +2,10 @@ script(src= rootPath + 'js/fetch.min.js') script(src= rootPath + 'js/perf-cascade.min.js') script(type='text/javascript'). - var outputHolderEl = document.getElementById("output"); - var pageSelectorEl = document.getElementById("page-selector"); - var legendHolderEl = document.getElementById("legend-holder"); - var options = { + const outputHolderEl = document.getElementById("output"); + const pageSelectorEl = document.getElementById("page-selector"); + const legendHolderEl = document.getElementById("legend-holder"); + const options = { rowHeight: 23, showAlignmentHelpers : false, showIndicatorIcons: false, @@ -21,10 +21,10 @@ if options.gzipHAR if (window["fetch"]) { window["fetch"]('data/browsertime.har.gz') .then(f => f.arrayBuffer()).then(arrayBuffer => { - var byteArray = new Uint8Array(arrayBuffer); - var gunzip = new Zlib.Gunzip(byteArray); - var decompressedArray = gunzip.decompress(); - var string = ''; + const byteArray = new Uint8Array(arrayBuffer); + const gunzip = new Zlib.Gunzip(byteArray); + const decompressedArray = gunzip.decompress(); + let string = ''; // only way to make it work on Safari iOS? try { string = new TextDecoder("utf-8").decode(decompressedArray); @@ -73,8 +73,8 @@ if options.gzipHAR } string = Utf8ArrayToStr(decompressedArray); } - var har = JSON.parse(string); - var perfCascadeSvg = perfCascade.fromHar(har, options); + const har = JSON.parse(string); + const perfCascadeSvg = perfCascade.fromHar(har, options); document.getElementById('output').classList.remove('loader'); outputHolderEl.appendChild(perfCascadeSvg); }) @@ -84,7 +84,7 @@ else if (window["fetch"]) { window["fetch"]('data/browsertime.har') .then(f => f.json()).then(har => { - var perfCascadeSvg = perfCascade.fromHar(har, options); + const perfCascadeSvg = perfCascade.fromHar(har, options); document.getElementById('output').classList.remove('loader'); outputHolderEl.appendChild(perfCascadeSvg); }) diff --git a/lib/plugins/html/templates/url/waterfall/includeHARinHTML.pug b/lib/plugins/html/templates/url/waterfall/includeHARinHTML.pug index 0a73906eb..f4612a583 100644 --- a/lib/plugins/html/templates/url/waterfall/includeHARinHTML.pug +++ b/lib/plugins/html/templates/url/waterfall/includeHARinHTML.pug @@ -5,10 +5,10 @@ script(src= rootPath + 'js/perf-cascade.min.js') script(type='text/javascript'). - var outputHolderEl = document.getElementById("output"); - var pageSelectorEl = document.getElementById("page-selector"); - var legendHolderEl = document.getElementById("legend-holder"); - var options = { + const outputHolderEl = document.getElementById("output"); + const pageSelectorEl = document.getElementById("page-selector"); + const legendHolderEl = document.getElementById("legend-holder"); + const options = { rowHeight: 23, showAlignmentHelpers : false, showIndicatorIcons: false, @@ -19,6 +19,6 @@ script(type='text/javascript'). pageSelector: pageSelectorEl }; - var har = !{JSON.stringify(dahar.log)}; - var perfCascadeSvg = perfCascade.fromHar(har, options); + const har = !{JSON.stringify(dahar.log)}; + const perfCascadeSvg = perfCascade.fromHar(har, options); outputHolderEl.appendChild(perfCascadeSvg); diff --git a/lib/plugins/html/templates/url/waterfall/index.pug b/lib/plugins/html/templates/url/waterfall/index.pug index 3950cac32..38d89dff0 100644 --- a/lib/plugins/html/templates/url/waterfall/index.pug +++ b/lib/plugins/html/templates/url/waterfall/index.pug @@ -21,7 +21,7 @@ else include ./includeHARinHTML.pug .downloads - - var harEnding = options.gzipHAR ? '.har.gz' : '.har' - - var harName = 'data/browsertime' + harEnding - - var harDownloadName = downloadName + harEnding + - const harEnding = options.gzipHAR ? '.har.gz' : '.har' + - const harName = 'data/browsertime' + harEnding + - const harDownloadName = downloadName + harEnding a.button.button-download(href=harName, download=harDownloadName) Download HAR diff --git a/lib/plugins/influxdb/data-generator.js b/lib/plugins/influxdb/data-generator.js index 3a522069d..4d2c6871b 100644 --- a/lib/plugins/influxdb/data-generator.js +++ b/lib/plugins/influxdb/data-generator.js @@ -10,7 +10,7 @@ class InfluxDBDataGenerator { this.includeQueryParams = !!includeQueryParams; this.options = options; this.defaultTags = {}; - for (var row of options.influxdb.tags.split(',')) { + for (let row of options.influxdb.tags.split(',')) { const keyAndValue = row.split('='); this.defaultTags[keyAndValue[0]] = keyAndValue[1]; } diff --git a/lib/plugins/influxdb/send-annotation.js b/lib/plugins/influxdb/send-annotation.js index 84ebce9a4..40e2cce00 100644 --- a/lib/plugins/influxdb/send-annotation.js +++ b/lib/plugins/influxdb/send-annotation.js @@ -37,7 +37,7 @@ module.exports = { const timestamp = Math.round(dayjs() / 1000); // if we have a category, let us send that category too if (options.influxdb.tags) { - for (var row of options.influxdb.tags.split(',')) { + for (let row of options.influxdb.tags.split(',')) { const keyAndValue = row.split('='); tags.push(keyAndValue[1]); } diff --git a/lib/plugins/webpagetest/pug/index.pug b/lib/plugins/webpagetest/pug/index.pug index 4a72b5522..d742824e0 100644 --- a/lib/plugins/webpagetest/pug/index.pug +++ b/lib/plugins/webpagetest/pug/index.pug @@ -10,9 +10,9 @@ mixin numberCell(title, number) mixin sizeCell(title, size) td.number(data-title=title, data-value= size)= h.size.format(size) -- var wpt = pageInfo.data.webpagetest.run ? pageInfo.data.webpagetest.run : pageInfo.data.webpagetest.pageSummary.data.median -- var wptRoot = pageInfo.data.webpagetest.run ? pageInfo.data.webpagetest : pageInfo.data.webpagetest.pageSummary.data; -- var wptRun = runNumber? runNumber : 1 +- const wpt = pageInfo.data.webpagetest.run ? pageInfo.data.webpagetest.run : pageInfo.data.webpagetest.pageSummary.data.median +- const wptRoot = pageInfo.data.webpagetest.run ? pageInfo.data.webpagetest : pageInfo.data.webpagetest.pageSummary.data; +- const wptRun = runNumber? runNumber : 1 a h2 WebPageTest @@ -73,20 +73,20 @@ p.small Metrics and data collected using #{options.webpagetest.host}.  img.u-max-full-width(src='data/screenshots/wpt-' + wptRun + '-firstView.png', alt='Screenshot') .downloads - - var harEnding = options.gzipHAR ? '.har.gz' : '.har' - - var harName = 'data/webpagetest' + harEnding - - var harDownloadName = downloadName + '-webpagetest-' + harEnding + - const harEnding = options.gzipHAR ? '.har.gz' : '.har' + - const harName = 'data/webpagetest' + harEnding + - const harDownloadName = downloadName + '-webpagetest-' + harEnding a.button.button-download(href=harName, download=downloadName) Download HAR if options.webpagetest.timeline - - var tracePath = 'data/trace-' + wptRun + '-wpt-firstView.json.gz' + - const tracePath = 'data/trace-' + wptRun + '-wpt-firstView.json.gz' a.button.button-download(href=tracePath, download=downloadName + 'trace-' + wptRun + '-wpt-firstView.json.gz') Download first view timeline if wpt.repeatView - - var tracePathRepeat = 'data/trace-' + wptRun + '-wpt-repeatView.json.gz' + - const tracePathRepeat = 'data/trace-' + wptRun + '-wpt-repeatView.json.gz' a.button.button-download(href=tracePathRepeat, download=downloadName + 'trace-' + wptRun + '-wpt-repeatView.json.gz') Download repeat view timeline each view in ['firstView', 'repeatView'] - - var median = wpt[view]; + - const median = wpt[view]; if median h2 #{view === 'firstView' ? 'First View': 'Repeat View'} if options.webpagetest.video @@ -127,7 +127,7 @@ each view in ['firstView', 'repeatView'] table tr th(colspan='2') Visual Progress - - var lastProgress = -1 + - let lastProgress = -1 each frame in median.videoFrames if lastProgress !== frame.VisuallyComplete - lastProgress = frame.VisuallyComplete diff --git a/lib/support/helpers/time.js b/lib/support/helpers/time.js index e66a2238a..eb56132dc 100644 --- a/lib/support/helpers/time.js +++ b/lib/support/helpers/time.js @@ -8,7 +8,7 @@ module.exports = { return ''; } - var secondsPerYear = 365 * 24 * 60 * 60, + const secondsPerYear = 365 * 24 * 60 * 60, secondsPerWeek = 60 * 60 * 24 * 7, secondsPerDay = 60 * 60 * 24, secondsPerHour = 60 * 60, diff --git a/test/graphiteTests.js b/test/graphiteTests.js index b9b411569..1bde752a4 100644 --- a/test/graphiteTests.js +++ b/test/graphiteTests.js @@ -31,7 +31,7 @@ describe('graphite', function() { connectivity: 'cable' }); - var data = generator.dataFromMessage(message, dayjs()); + const data = generator.dataFromMessage(message, dayjs()); expect(data).to.match(/ns.pageSummary.sub_domain_com/); expect(data).to.match(/bar.gpsi.median/); expect(data).to.match(/foo_bar/); @@ -63,7 +63,7 @@ describe('graphite', function() { browser: 'chrome', connectivity: 'cable' }); - var data = generator.dataFromMessage(message, dayjs()); + const data = generator.dataFromMessage(message, dayjs()); expect(data).to.match( /ns.summary.sub_domain_com.chrome.cable.domains.www.sitespeed.io.dns.median [\d]{1,} [\d]*/ @@ -97,7 +97,7 @@ describe('graphite', function() { connectivity: 'cable', graphite: { statsd: true } }); - var data = generator.dataFromMessage(message, dayjs()); + const data = generator.dataFromMessage(message, dayjs()); data.forEach(function(line) { expect(line).to.match( diff --git a/test/helpers/first.js b/test/helpers/first.js index 37af579df..70586e287 100644 --- a/test/helpers/first.js +++ b/test/helpers/first.js @@ -1,6 +1,6 @@ 'use strict'; -var Bluebird = require('bluebird'), +const Bluebird = require('bluebird'), chai = require('chai'), chaiAsPromised = require('chai-as-promised'); diff --git a/test/influxdbTests.js b/test/influxdbTests.js index d7b560729..162c1ccaf 100644 --- a/test/influxdbTests.js +++ b/test/influxdbTests.js @@ -354,7 +354,7 @@ describe('influxdb', function() { } }); - var data = generator.dataFromMessage(message, dayjs()); + const data = generator.dataFromMessage(message, dayjs()); expect(data).to.not.be.empty; diff --git a/tools/tcp-server.js b/tools/tcp-server.js index 8d25713e5..736f07feb 100755 --- a/tools/tcp-server.js +++ b/tools/tcp-server.js @@ -1,15 +1,15 @@ #!/usr/bin/env node /*eslint no-console: 0*/ -var net = require('net'); +const net = require('net'); -var server = net +const server = net .createServer(function(sock) { sock.on('data', function(data) { console.log(data.toString()); }); }) .listen(process.argv[2] || 0, undefined, undefined, () => { - var address = server.address(); + const address = server.address(); console.log('Server listening on ' + address.address + ':' + address.port); });