From 5c0627841f57bc868597d1ccdba1cc3f4dde4741 Mon Sep 17 00:00:00 2001 From: Gleb Bahmutov Date: Thu, 12 Oct 2023 09:27:38 -0400 Subject: [PATCH] simplify code --- src/index.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index 09a8837..5f9d208 100644 --- a/src/index.js +++ b/src/index.js @@ -139,15 +139,10 @@ function cypressSplit(on, config) { const specRows = splitSpecs.map((absoluteSpecPath, k) => { const relativeName = specAbsoluteToRelative[absoluteSpecPath] const specRow = [String(k + 1), relativeName] - return specRow - }) - specRows.forEach((specRow) => { - const specAbsolutePath = specRow[1] - const specResult = specResults[specAbsolutePath] + const specResult = specResults[absoluteSpecPath] if (specResult) { // shorted to relative filename - const relativeName = specAbsoluteToRelative[specAbsolutePath] debug('spec results for %s', relativeName) debug(specResult.stats) // have to convert numbers to strings @@ -157,8 +152,10 @@ function cypressSplit(on, config) { specRow.push(String(specResult.stats.skipped)) specRow.push(humanizeDuration(specResult.stats.wallClockDuration)) } else { - console.error('Could not find spec results for %s', specAbsolutePath) + console.error('Could not find spec results for %s', absoluteSpecPath) } + + return specRow }) return specRows