0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-23 09:26:51 -05:00

improve test report log

This commit is contained in:
liabru 2021-01-31 17:34:38 +00:00
parent 92080ff49b
commit b5326f8e49
2 changed files with 7 additions and 5 deletions

View file

@ -54,7 +54,9 @@ afterAll(async () => {
const build = await capturesBuild;
console.log(
logReport(dev) + '\n'
'Examples ran against previous release and current version\n\n'
+ logReport(build, `release`) + '\n'
+ logReport(dev, `current`) + '\n'
+ comparisonReport(dev, build, MatterBuild.version, saveComparison)
);
});

View file

@ -202,7 +202,7 @@ const equals = (a, b) => {
return true;
};
const logReport = captures => {
const logReport = (captures, version) => {
let report = '';
for (const capture of Object.values(captures)) {
@ -217,8 +217,8 @@ const logReport = captures => {
}
}
return report ? `Output logs on last run\n\n${report}`
: 'Output logs on last run\n\n None\n';
return `Output logs from ${color(version, colors.Yellow)} version on last run\n\n`
+ (report ? report : ' None\n');
};
const comparisonReport = (capturesDev, capturesBuild, buildVersion, save) => {
@ -271,7 +271,7 @@ const comparisonReport = (capturesDev, capturesBuild, buildVersion, save) => {
const report = (breakEvery, format) => [
[`Output comparison of ${similarityEntries.length}`,
`examples against ${format('matter-js@' + buildVersion, colors.Yellow)} build on last run`
`examples against previous release ${format('matter-js@' + buildVersion, colors.Yellow)}`
].join(' '),
`\n\n${format('Similarity', colors.White)}`,
`${format(toPercent(similarityAvg), similarityAvg === 1 ? colors.Green : colors.Yellow)}%`,