Skip to content

Commit 66593cf

Browse files
committed
likely fix
1 parent bdcb206 commit 66593cf

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

scripts/unit-coverage.mjs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ const testFiles = readdirSync("tests/unit")
3434
.sort()
3535
.map((fileName) => `./tests/unit/${fileName}`);
3636

37+
// Ensure coverage outputs can always be written, including retry reporter files in CI.
38+
mkdirSync("coverage", { recursive: true });
39+
3740
function runCoverageAttempt({
3841
label,
3942
extraArgs = [],
@@ -162,7 +165,7 @@ const primaryMissing = trackedFiles.filter(
162165
);
163166

164167
if (primaryMissing.length === trackedFiles.length) {
165-
const lcovPath = "coverage/unit-retry.lcov";
168+
const lcovPath = `${process.cwd()}/coverage/unit-retry.lcov`;
166169
if (existsSync(lcovPath)) unlinkSync(lcovPath);
167170

168171
const retryAttempt = runCoverageAttempt({
@@ -306,16 +309,16 @@ if (failures.length > 0) {
306309
status: primaryAttempt.result.status,
307310
signal: primaryAttempt.result.signal,
308311
args: primaryAttempt.args,
309-
outputPreview: stripAnsi(primaryAttempt.combinedOutput).split("\n").slice(-120),
310-
},
311-
{
312-
label: activeAttempt.label,
313-
status: activeAttempt.result.status,
314-
signal: activeAttempt.result.signal,
315-
args: activeAttempt.args,
316-
outputPreview: stripAnsi(activeAttempt.combinedOutput).split("\n").slice(-120),
317-
},
318-
],
312+
outputPreview: stripAnsi(primaryAttempt.combinedOutput).split("\n").slice(-120),
313+
},
314+
{
315+
label: activeAttempt.label,
316+
status: activeAttempt.result.status,
317+
signal: activeAttempt.result.signal,
318+
args: activeAttempt.args,
319+
outputPreview: stripAnsi(activeAttempt.combinedOutput).split("\n").slice(-120),
320+
},
321+
],
319322
message:
320323
"Coverage parsing found no tracked files even after retry. This usually indicates a Node test-coverage reporter regression in CI runtime.",
321324
};

0 commit comments

Comments
 (0)