From 8fdef048757b51eb8561c1b4a4443c9ab2449d40 Mon Sep 17 00:00:00 2001 From: cenfun Date: Sat, 29 Jun 2024 12:56:38 +0800 Subject: [PATCH] fixed warn message for adding empty istanbul coverage --- lib/generate.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/generate.js b/lib/generate.js index 51b76fbc..b07bffa1 100644 --- a/lib/generate.js +++ b/lib/generate.js @@ -720,7 +720,14 @@ const addEmptyData = async (mcr, dataList, sourceCache) => { return; } - Util.logDebug(`added "all" files with empty coverage: ${EC.yellow(emptyData.length)}`); + let files = 0; + if (Util.isList(emptyData)) { + files = emptyData.length; + } else { + files = Object.keys(emptyData).length; + } + + Util.logDebug(`added all files with empty coverage: ${EC.yellow(files)}`); const coverageResults = await mcr.add(emptyData); // after `add` if (!coverageResults) {