Skip to content

Commit

Permalink
Run 'npx standard --fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
token-cjg committed Sep 1, 2022
1 parent edd70b6 commit cde08af
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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']) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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++
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion lib/result.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))}`)
Expand Down
4 changes: 2 additions & 2 deletions lib/testConstantHeapSize.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down

0 comments on commit cde08af

Please sign in to comment.