Skip to content

Commit

Permalink
update log color
Browse files Browse the repository at this point in the history
  • Loading branch information
cenfun committed Nov 3, 2024
1 parent c1ce6c2 commit 966177c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
8 changes: 4 additions & 4 deletions lib/converter/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ const convertCoverages = (list, options, untested) => {
}
}

logConvertTime(` [convert] parsed ast: ${sourcePath} (${EC.cyan(Util.BSF(maxContentLength))})`, time_start_ast, untested);
logConvertTime(`${EC.magenta('│ ')}${EC.cyan('├')} [convert] parsed ast: ${sourcePath} (${EC.cyan(Util.BSF(maxContentLength))})`, time_start_ast, untested);

// console.log(sourcePath, astInfo.statements.length);
// ============================
Expand Down Expand Up @@ -1390,7 +1390,7 @@ const convertCoverages = (list, options, untested) => {

stateList.push(state);

logConvertTime(` [convert] unpacked sourcemap: ${sourcePath} (${unpackedFiles})`, time_start_unpack, untested);
logConvertTime(`${EC.magenta('│ ')}${EC.cyan('├')} [convert] unpacked sourcemap: ${sourcePath} (${unpackedFiles})`, time_start_unpack, untested);

}

Expand Down Expand Up @@ -1616,7 +1616,7 @@ const addUntestedFiles = async (stateList, options) => {

// console.log('untestedList', untestedList);

Util.logTime(` [convert] added untested files: ${EC.yellow(untestedList.length)}`, time_start_untested);
Util.logTime(`${EC.magenta('│ ')}${EC.cyan('├')} [convert] added untested files: ${EC.yellow(untestedList.length)}`, time_start_untested);


};
Expand Down Expand Up @@ -1708,7 +1708,7 @@ const convertV8List = async (v8list, options) => {
const time_start_convert = Date.now();
const dataList = generateV8DataList(stateList, options);
const dataFiles = EC.cyan(`${dataList.v8DataList.length} files`);
Util.logTime(` [convert] converted data list (${dataFiles})`, time_start_convert);
Util.logTime(`${EC.magenta('│ ')}${EC.cyan('├')} [convert] converted data list (${dataFiles})`, time_start_convert);

return dataList;
};
Expand Down
9 changes: 5 additions & 4 deletions lib/generate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const fs = require('fs');
const path = require('path');
const { fileURLToPath } = require('url');
const EC = require('eight-colors');

const Util = require('./utils/util.js');
const { convertV8List } = require('./converter/converter.js');
Expand Down Expand Up @@ -172,12 +173,12 @@ const getCoverageResults = async (dataList, sourceCache, options) => {
// merge v8list first
const t1 = Date.now();
const v8list = await mergeV8Coverage(dataList, sourceCache, options);
Util.logTime('┌ [generate] merged v8 coverage data', t1);
Util.logTime(`${EC.magenta('├')} [generate] merged v8 coverage data`, t1);
// console.log('after merge', v8list.map((it) => it.url));

const t2 = Date.now();
const results = await convertV8List(v8list, options);
Util.logTime('┌ [generate] converted coverage data', t2);
Util.logTime(`${EC.magenta('├')} [generate] converted coverage data`, t2);

const {
v8DataList, coverageData, fileSources
Expand All @@ -189,7 +190,7 @@ const getCoverageResults = async (dataList, sourceCache, options) => {
const t3 = Date.now();
const istanbulData = await mergeIstanbulCoverage(dataList, options);
const { coverageData, fileSources } = initIstanbulData(istanbulData, options);
Util.logTime('┌ [generate] prepared istanbul coverage data', t3);
Util.logTime(`${EC.magenta('├')} [generate] prepared istanbul coverage data`, t3);
const results = await saveIstanbulReports(coverageData, fileSources, options);
return results;
};
Expand All @@ -210,7 +211,7 @@ const generateCoverageReports = async (dataList, sourceCache, options) => {
} else {
await customReport(reportName, coverageResults, reportOptions, options);
}
Util.logTime(` [generate] saved report: ${reportName}`, t1);
Util.logTime(`${EC.magenta('├')} [generate] saved report: ${reportName}`, t1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class CoverageReport {
});
}

Util.logTime('┌ [generate] prepared coverage data', time_start);
Util.logTime(`${EC.magenta('├')} [generate] prepared coverage data`, time_start);

const coverageResults = await generateCoverageReports(dataList, sourceCache, this.options);

Expand Down
3 changes: 2 additions & 1 deletion lib/istanbul/istanbul.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const path = require('path');
const istanbulReports = require('istanbul-reports');
const istanbulLibCoverage = require('istanbul-lib-coverage');
const istanbulLibReport = require('istanbul-lib-report');
const EC = require('eight-colors');

const Util = require('../utils/util.js');
const IstanbulSummary = require('./istanbul-summary.js');
Expand Down Expand Up @@ -95,7 +96,7 @@ const saveIstanbulReports = (coverageData, fileSources, options) => {
const t1 = Date.now();
const report = istanbulReports.create(reportName, reportOptions);
report.execute(context);
Util.logTime(` [generate] saved report: ${reportName}`, t1);
Util.logTime(`${EC.magenta('├')} [generate] saved report: ${reportName}`, t1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/v8/v8.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ const saveV8Report = async (v8list, options, istanbulReportPath) => {
} else {
outputs[reportName] = await customReport(reportName, reportData, reportOptions, options);
}
Util.logTime(` [generate] saved report: ${reportName}`, t1);
Util.logTime(`${EC.magenta('├')} [generate] saved report: ${reportName}`, t1);
}
}

Expand Down

0 comments on commit 966177c

Please sign in to comment.