From 717001bf9c0aac3fde8f72e4332654a3395f1abd Mon Sep 17 00:00:00 2001 From: Christopher Goddard Date: Fri, 2 Sep 2022 06:56:55 +1000 Subject: [PATCH] Run 'npx standard --fix' --- lib/index.js | 14 +++++++------- lib/result.js | 2 +- lib/testConstantHeapSize.js | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/index.js b/lib/index.js index 0b92a79..4954b37 100644 --- a/lib/index.js +++ b/lib/index.js @@ -44,7 +44,7 @@ function iterate (iteratorFn, options = {}) { for (let index = 0; index < iterations; index++) { const result = iteratorFn() if (result && typeof result.then === 'function') { - throw new Error(`Tried to use iterate() on an async function. Use iterate.async() instead.`) + throw new Error('Tried to use iterate() on an async function. Use iterate.async() instead.') } } return heapDiff.end() @@ -54,7 +54,7 @@ function iterate (iteratorFn, options = {}) { const heapDiffs = new Array(gcollections) for (let gcIndex = 0; gcIndex < gcollections; gcIndex++) { - heapDiffs[ gcIndex ] = runAndHeapDiff() + heapDiffs[gcIndex] = runAndHeapDiff() } if (argv['heap-file']) { @@ -107,7 +107,7 @@ iterate.async = function iterateAsync (iteratorFn, options = {}) { }, onHeapDiff () { memwatch.gc() - heapDiffs[ runner.gcIndex ] = runner.heapDiff.end() + heapDiffs[runner.gcIndex] = runner.heapDiff.end() runner.gcIndex++ if (runner.gcIndex === gcollections) { @@ -143,9 +143,9 @@ iterate.async = function iterateAsync (iteratorFn, options = {}) { if (currentlyRunningTests > 0) { return reject(new Error( - `Detected concurrently running tests. ` + - `This will render the heap snapshots unusable. ` + - `Make sure the tests are run strictly sequentially.` + 'Detected concurrently running tests. ' + + 'This will render the heap snapshots unusable. ' + + 'Make sure the tests are run strictly sequentially.' )) } currentlyRunningTests++ @@ -154,7 +154,7 @@ iterate.async = function iterateAsync (iteratorFn, options = {}) { const promise = iteratorFn() if (!promise || typeof promise.then !== 'function') { - return reject(new Error(`Tried to use iterate.async() on a synchronous function. Use iterate() instead.`)) + return reject(new Error('Tried to use iterate.async() on a synchronous function. Use iterate() instead.')) } promise.then( diff --git a/lib/result.js b/lib/result.js index 49f02f7..e5467d8 100644 --- a/lib/result.js +++ b/lib/result.js @@ -17,7 +17,7 @@ class Result { const minimum = changesInBytes.reduce((min, change) => change < min ? change : min, Infinity) const maximum = changesInBytes.reduce((max, change) => change > max ? change : max, -Infinity) - log(title ? `Leak test summary - ${title}:` : `Leak test summary:`) + log(title ? `Leak test summary - ${title}:` : 'Leak test summary:') log(` Did ${this.gcollections} heap diffs, iterating ${this.iterations} times each.`) log(` Heap diff summary: ${formatDiffSize(average)} avg, ${formatDiffSize(minimum)} min, ${formatDiffSize(maximum)} max`) log(` Heap diffs: ${this.heapDiffs.map(heapDiff => formatDiffSize(heapDiff.change.size_bytes))}`) diff --git a/lib/testConstantHeapSize.js b/lib/testConstantHeapSize.js index 8cb398f..2a314f6 100644 --- a/lib/testConstantHeapSize.js +++ b/lib/testConstantHeapSize.js @@ -13,7 +13,7 @@ function testConstantHeapSize (heapDiffs, { iterations, gcollections, sensitivit const throwOnSubsequentHeapGrowths = Math.floor(heapDiffs.length * 2 / 3) if (subsequentHeapGrowths.length > throwOnSubsequentHeapGrowths) { - const lastHeapDiff = subsequentHeapGrowths[ subsequentHeapGrowths.length - 1 ] + const lastHeapDiff = subsequentHeapGrowths[subsequentHeapGrowths.length - 1] const heapGrowthIterations = Math.round(subsequentHeapGrowths.length * iterations) const growthInBytes = subsequentHeapGrowths @@ -25,7 +25,7 @@ function testConstantHeapSize (heapDiffs, { iterations, gcollections, sensitivit `(${formatInteger(heapGrowthIterations)} of ${iterations * gcollections} iterations) ` + `by ${prettyBytes(growthInBytes)}.\n\n` + ` Iterations between GCs: ${formatInteger(iterations)}\n\n` + - ` Final GC details:\n` + + ' Final GC details:\n' + ` ${prettyHeapContents(lastHeapDiff).trimLeft()}\n` ) } else {