@callstack/reassure-compare
Advanced tools
Comparing version 1.0.0-rc.4 to 1.0.0-rc.5
@@ -135,5 +135,7 @@ "use strict"; | ||
}); | ||
const withCurrent = [...compared, ...added]; | ||
const significant = compared.filter(item => item.isDurationDiffSignificant).sort((a, b) => b.durationDiff - a.durationDiff); | ||
const meaningless = compared.filter(item => !item.isDurationDiffSignificant).sort((a, b) => a.name.localeCompare(b.name)); | ||
const countChanged = compared.filter(item => Math.abs(item.countDiff) > COUNT_DIFF_THRESHOLD).sort((a, b) => b.countDiff - a.countDiff); | ||
const renderIssues = withCurrent.filter(item => item.current.issues?.initialUpdateCount || item.current.issues?.redundantUpdates?.length); | ||
added.sort((a, b) => a.name.localeCompare(b.name)); | ||
@@ -151,2 +153,3 @@ removed.sort((a, b) => a.name.localeCompare(b.name)); | ||
countChanged, | ||
renderIssues, | ||
added, | ||
@@ -158,3 +161,3 @@ removed | ||
/** | ||
* Establish statisticial significance of render/execution duration difference build compare entry. | ||
* Establish statistical significance of render/execution duration difference build compare entry. | ||
*/ | ||
@@ -161,0 +164,0 @@ function buildCompareEntry(name, current, baseline) { |
@@ -6,2 +6,4 @@ "use strict"; | ||
}); | ||
exports.formatInitialUpdates = formatInitialUpdates; | ||
exports.formatRedundantUpdates = formatRedundantUpdates; | ||
exports.printToConsole = printToConsole; | ||
@@ -20,10 +22,30 @@ var logger = _interopRequireWildcard(require("@callstack/reassure-logger")); | ||
data.significant.forEach(printRegularLine); | ||
if (data.significant.length === 0) { | ||
logger.log(' - (none)'); | ||
} | ||
logger.log('\n➡️ Meaningless changes to duration'); | ||
data.meaningless.forEach(printRegularLine); | ||
logger.log('\n➡️ Count changes'); | ||
if (data.meaningless.length === 0) { | ||
logger.log(' - (none)'); | ||
} | ||
logger.log('\n➡️ Render count changes'); | ||
data.countChanged.forEach(printRegularLine); | ||
if (data.countChanged.length === 0) { | ||
logger.log(' - (none)'); | ||
} | ||
logger.log('\n➡️ Render issues'); | ||
data.renderIssues.forEach(printRenderIssuesLine); | ||
if (data.renderIssues.length === 0) { | ||
logger.log(' - (none)'); | ||
} | ||
logger.log('\n➡️ Added scenarios'); | ||
data.added.forEach(printAddedLine); | ||
if (data.added.length === 0) { | ||
logger.log(' - (none)'); | ||
} | ||
logger.log('\n➡️ Removed scenarios'); | ||
data.removed.forEach(printRemovedLine); | ||
if (data.removed.length === 0) { | ||
logger.log(' - (none)'); | ||
} | ||
logger.newLine(); | ||
@@ -35,4 +57,16 @@ } | ||
function printRegularLine(entry) { | ||
logger.log(` - ${entry.name} [${entry.type}]: ${(0, _format.formatDurationChange)(entry)} | ${(0, _format.formatCountChange)(entry)}`); | ||
logger.log(` - ${entry.name} [${entry.type}]: ${(0, _format.formatDurationChange)(entry)} | ${(0, _format.formatCountChange)(entry.current.meanCount, entry.baseline.meanCount)}`); | ||
} | ||
function printRenderIssuesLine(entry) { | ||
const issues = []; | ||
const initialUpdateCount = entry.current.issues?.initialUpdateCount; | ||
if (initialUpdateCount) { | ||
issues.push(formatInitialUpdates(initialUpdateCount)); | ||
} | ||
const redundantUpdates = entry.current.issues?.redundantUpdates; | ||
if (redundantUpdates?.length) { | ||
issues.push(formatRedundantUpdates(redundantUpdates)); | ||
} | ||
logger.log(` - ${entry.name}: ${issues.join(' | ')}`); | ||
} | ||
function printAddedLine(entry) { | ||
@@ -50,2 +84,12 @@ const { | ||
} | ||
function formatInitialUpdates(count) { | ||
if (count === 0) return '-'; | ||
if (count === 1) return '1 initial update 🔴'; | ||
return `${count} initial updates 🔴`; | ||
} | ||
function formatRedundantUpdates(redundantUpdates) { | ||
if (redundantUpdates.length === 0) return '-'; | ||
if (redundantUpdates.length === 1) return `1 redundant update (${redundantUpdates.join(', ')}) 🔴`; | ||
return `${redundantUpdates.length} redundant updates (${redundantUpdates.join(', ')}) 🔴`; | ||
} | ||
//# sourceMappingURL=console.js.map |
@@ -6,4 +6,2 @@ "use strict"; | ||
}); | ||
exports.collapsibleSection = collapsibleSection; | ||
exports.formatRunDurations = formatRunDurations; | ||
exports.writeToMarkdown = void 0; | ||
@@ -15,3 +13,4 @@ var fs = _interopRequireWildcard(require("fs/promises")); | ||
var _format = require("../utils/format"); | ||
var md = _interopRequireWildcard(require("../utils/markdown")); | ||
var _markdown = _interopRequireWildcard(require("../utils/markdown")); | ||
var md = _markdown; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -67,5 +66,13 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
result += `\n${buildDetailsTable(data.meaningless)}`; | ||
result += `\n\n${md.heading3('Changes To Count')}`; | ||
result += `\n${buildSummaryTable(data.countChanged)}`; | ||
result += `\n${buildDetailsTable(data.countChanged)}`; | ||
// Skip renders counts if user only has function measurements | ||
const allEntries = [...data.significant, ...data.meaningless, ...data.added, ...data.removed]; | ||
const hasRenderEntries = allEntries.some(e => e.type === 'render'); | ||
if (hasRenderEntries) { | ||
result += `\n\n${md.heading3('Render Count Changes')}`; | ||
result += `\n${buildSummaryTable(data.countChanged)}`; | ||
result += `\n${buildDetailsTable(data.countChanged)}`; | ||
result += `\n\n${md.heading3('Render Issues')}`; | ||
result += `\n${buildRedundantRendersTable(data.renderIssues)}`; | ||
} | ||
result += `\n\n${md.heading3('Added Scenarios')}`; | ||
@@ -87,3 +94,3 @@ result += `\n${buildSummaryTable(data.added)}`; | ||
const content = (0, _markdownTable.default)([tableHeader, ...rows]); | ||
return collapse ? collapsibleSection('Show entries', content) : content; | ||
return collapse ? (0, _markdown.collapsibleSection)('Show entries', content) : content; | ||
} | ||
@@ -94,7 +101,7 @@ function buildDetailsTable(entries) { | ||
const content = (0, _markdownTable.default)([tableHeader, ...rows]); | ||
return collapsibleSection('Show details', content); | ||
return (0, _markdown.collapsibleSection)('Show details', content); | ||
} | ||
function formatEntryDuration(entry) { | ||
if ('baseline' in entry && 'current' in entry) return (0, _format.formatDurationChange)(entry); | ||
if ('baseline' in entry) return (0, _format.formatDuration)(entry.baseline.meanDuration); | ||
if (entry.baseline != null && 'current' in entry) return (0, _format.formatDurationChange)(entry); | ||
if (entry.baseline != null) return (0, _format.formatDuration)(entry.baseline.meanDuration); | ||
if ('current' in entry) return (0, _format.formatDuration)(entry.current.meanDuration); | ||
@@ -104,4 +111,4 @@ return ''; | ||
function formatEntryCount(entry) { | ||
if ('baseline' in entry && 'current' in entry) return (0, _format.formatCountChange)(entry); | ||
if ('baseline' in entry) return (0, _format.formatCount)(entry.baseline.meanCount); | ||
if (entry.baseline != null && 'current' in entry) return (0, _format.formatCountChange)(entry.current.meanCount, entry.baseline.meanCount); | ||
if (entry.baseline != null) return (0, _format.formatCount)(entry.baseline.meanCount); | ||
if ('current' in entry) return (0, _format.formatCount)(entry.current.meanCount); | ||
@@ -111,6 +118,6 @@ return ''; | ||
function buildDurationDetailsEntry(entry) { | ||
return ['baseline' in entry ? buildDurationDetails('Baseline', entry.baseline) : '', 'current' in entry ? buildDurationDetails('Current', entry.current) : ''].filter(Boolean).join('<br/><br/>'); | ||
return [entry.baseline != null ? buildDurationDetails('Baseline', entry.baseline) : '', 'current' in entry ? buildDurationDetails('Current', entry.current) : ''].filter(Boolean).join('<br/><br/>'); | ||
} | ||
function buildCountDetailsEntry(entry) { | ||
return ['baseline' in entry ? buildCountDetails('Baseline', entry.baseline) : '', 'current' in entry ? buildCountDetails('Current', entry.current) : ''].filter(Boolean).join('<br/><br/>'); | ||
return [entry.baseline != null ? buildCountDetails('Baseline', entry.baseline) : '', 'current' in entry ? buildCountDetails('Current', entry.current) : ''].filter(Boolean).join('<br/><br/>'); | ||
} | ||
@@ -125,8 +132,21 @@ function buildDurationDetails(title, entry) { | ||
} | ||
function collapsibleSection(title, content) { | ||
return `<details>\n<summary>${title}</summary>\n\n${content}\n</details>\n\n`; | ||
} | ||
function formatRunDurations(values) { | ||
return values.map(v => Number.isInteger(v) ? `${v}` : `${v.toFixed(1)}`).join(' '); | ||
} | ||
function buildRedundantRendersTable(entries) { | ||
if (!entries.length) return md.italic('There are no entries'); | ||
const tableHeader = ['Name', 'Initial Updates', 'Redundant Updates']; | ||
const rows = entries.map(entry => [entry.name, formatInitialUpdates(entry.current.issues?.initialUpdateCount), formatRedundantUpdates(entry.current.issues?.redundantUpdates)]); | ||
return (0, _markdownTable.default)([tableHeader, ...rows]); | ||
} | ||
function formatInitialUpdates(count) { | ||
if (count == null) return '?'; | ||
if (count === 0) return '-'; | ||
return `${count} 🔴`; | ||
} | ||
function formatRedundantUpdates(redundantUpdates) { | ||
if (redundantUpdates == null) return '?'; | ||
if (redundantUpdates.length === 0) return '-'; | ||
return `${redundantUpdates.length} (${redundantUpdates.join(', ')}) 🔴`; | ||
} | ||
//# sourceMappingURL=markdown.js.map |
@@ -41,4 +41,8 @@ "use strict"; | ||
/** Array of measured render/execution counts for each run. */ | ||
counts: _zod.z.array(_zod.z.number()) | ||
counts: _zod.z.array(_zod.z.number()), | ||
issues: _zod.z.optional(_zod.z.object({ | ||
initialUpdateCount: _zod.z.number().optional(), | ||
redundantUpdates: _zod.z.array(_zod.z.number()).optional() | ||
})) | ||
}); | ||
//# sourceMappingURL=type-schemas.js.map |
@@ -44,9 +44,26 @@ "use strict"; | ||
function formatCount(value) { | ||
if (value == null) { | ||
return '?'; | ||
} | ||
return Number.isInteger(value) ? `${value}` : `${value.toFixed(2)}`; | ||
} | ||
function formatCountDiff(value) { | ||
if (value > 0) return `+${value}`; | ||
if (value < 0) return `${value}`; | ||
function formatCountDiff(current, baseline) { | ||
const diff = current - baseline; | ||
if (diff > 0) return `+${diff}`; | ||
if (diff < 0) return `${diff}`; | ||
return '±0'; | ||
} | ||
function formatCountChange(current, baseline) { | ||
let output = `${formatCount(baseline)} → ${formatCount(current)}`; | ||
if (baseline != null && current != null && baseline !== current) { | ||
const parts = [formatCountDiff(current, baseline)]; | ||
if (baseline > 0) { | ||
const relativeDiff = (current - baseline) / baseline; | ||
parts.push(formatPercentChange(relativeDiff)); | ||
} | ||
output += ` (${parts.join(', ')})`; | ||
} | ||
output += ` ${getCountChangeSymbols(current, baseline)}`; | ||
return output; | ||
} | ||
function formatChange(value) { | ||
@@ -81,19 +98,11 @@ if (value > 0) return `+${value}`; | ||
} | ||
function formatCountChange(entry) { | ||
const { | ||
baseline, | ||
current | ||
} = entry; | ||
let output = `${formatCount(baseline.meanCount)} → ${formatCount(current.meanCount)}`; | ||
if (baseline.meanCount != current.meanCount) { | ||
output += ` (${formatCountDiff(entry.countDiff)}, ${formatPercentChange(entry.relativeCountDiff)})`; | ||
function getCountChangeSymbols(current, baseline) { | ||
if (current == null || baseline == null) { | ||
return ''; | ||
} | ||
output += ` ${getCountChangeSymbols(entry)}`; | ||
return output; | ||
} | ||
function getCountChangeSymbols(entry) { | ||
if (entry.countDiff > 1.5) return '🔴🔴'; | ||
if (entry.countDiff > 0.5) return '🔴'; | ||
if (entry.countDiff < -1.5) return '🟢🟢'; | ||
if (entry.countDiff < -0.5) return '🟢'; | ||
const diff = current - baseline; | ||
if (diff > 1.5) return '🔴🔴'; | ||
if (diff > 0.5) return '🔴'; | ||
if (diff < -1.5) return '🟢🟢'; | ||
if (diff < -0.5) return '🟢'; | ||
return ''; | ||
@@ -100,0 +109,0 @@ } |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.bold = bold; | ||
exports.collapsibleSection = collapsibleSection; | ||
exports.heading1 = heading1; | ||
@@ -27,2 +28,5 @@ exports.heading2 = heading2; | ||
} | ||
function collapsibleSection(title, content) { | ||
return `<details>\n<summary>${title}</summary>\n\n${content}\n</details>\n\n`; | ||
} | ||
//# sourceMappingURL=markdown.js.map |
@@ -127,5 +127,7 @@ import * as fsSync from 'fs'; | ||
}); | ||
const withCurrent = [...compared, ...added]; | ||
const significant = compared.filter(item => item.isDurationDiffSignificant).sort((a, b) => b.durationDiff - a.durationDiff); | ||
const meaningless = compared.filter(item => !item.isDurationDiffSignificant).sort((a, b) => a.name.localeCompare(b.name)); | ||
const countChanged = compared.filter(item => Math.abs(item.countDiff) > COUNT_DIFF_THRESHOLD).sort((a, b) => b.countDiff - a.countDiff); | ||
const renderIssues = withCurrent.filter(item => item.current.issues?.initialUpdateCount || item.current.issues?.redundantUpdates?.length); | ||
added.sort((a, b) => a.name.localeCompare(b.name)); | ||
@@ -143,2 +145,3 @@ removed.sort((a, b) => a.name.localeCompare(b.name)); | ||
countChanged, | ||
renderIssues, | ||
added, | ||
@@ -150,3 +153,3 @@ removed | ||
/** | ||
* Establish statisticial significance of render/execution duration difference build compare entry. | ||
* Establish statistical significance of render/execution duration difference build compare entry. | ||
*/ | ||
@@ -153,0 +156,0 @@ function buildCompareEntry(name, current, baseline) { |
@@ -11,10 +11,30 @@ import * as logger from '@callstack/reassure-logger'; | ||
data.significant.forEach(printRegularLine); | ||
if (data.significant.length === 0) { | ||
logger.log(' - (none)'); | ||
} | ||
logger.log('\n➡️ Meaningless changes to duration'); | ||
data.meaningless.forEach(printRegularLine); | ||
logger.log('\n➡️ Count changes'); | ||
if (data.meaningless.length === 0) { | ||
logger.log(' - (none)'); | ||
} | ||
logger.log('\n➡️ Render count changes'); | ||
data.countChanged.forEach(printRegularLine); | ||
if (data.countChanged.length === 0) { | ||
logger.log(' - (none)'); | ||
} | ||
logger.log('\n➡️ Render issues'); | ||
data.renderIssues.forEach(printRenderIssuesLine); | ||
if (data.renderIssues.length === 0) { | ||
logger.log(' - (none)'); | ||
} | ||
logger.log('\n➡️ Added scenarios'); | ||
data.added.forEach(printAddedLine); | ||
if (data.added.length === 0) { | ||
logger.log(' - (none)'); | ||
} | ||
logger.log('\n➡️ Removed scenarios'); | ||
data.removed.forEach(printRemovedLine); | ||
if (data.removed.length === 0) { | ||
logger.log(' - (none)'); | ||
} | ||
logger.newLine(); | ||
@@ -26,4 +46,16 @@ } | ||
function printRegularLine(entry) { | ||
logger.log(` - ${entry.name} [${entry.type}]: ${formatDurationChange(entry)} | ${formatCountChange(entry)}`); | ||
logger.log(` - ${entry.name} [${entry.type}]: ${formatDurationChange(entry)} | ${formatCountChange(entry.current.meanCount, entry.baseline.meanCount)}`); | ||
} | ||
function printRenderIssuesLine(entry) { | ||
const issues = []; | ||
const initialUpdateCount = entry.current.issues?.initialUpdateCount; | ||
if (initialUpdateCount) { | ||
issues.push(formatInitialUpdates(initialUpdateCount)); | ||
} | ||
const redundantUpdates = entry.current.issues?.redundantUpdates; | ||
if (redundantUpdates?.length) { | ||
issues.push(formatRedundantUpdates(redundantUpdates)); | ||
} | ||
logger.log(` - ${entry.name}: ${issues.join(' | ')}`); | ||
} | ||
function printAddedLine(entry) { | ||
@@ -41,2 +73,12 @@ const { | ||
} | ||
export function formatInitialUpdates(count) { | ||
if (count === 0) return '-'; | ||
if (count === 1) return '1 initial update 🔴'; | ||
return `${count} initial updates 🔴`; | ||
} | ||
export function formatRedundantUpdates(redundantUpdates) { | ||
if (redundantUpdates.length === 0) return '-'; | ||
if (redundantUpdates.length === 1) return `1 redundant update (${redundantUpdates.join(', ')}) 🔴`; | ||
return `${redundantUpdates.length} redundant updates (${redundantUpdates.join(', ')}) 🔴`; | ||
} | ||
//# sourceMappingURL=console.js.map |
@@ -8,2 +8,3 @@ import * as fs from 'fs/promises'; | ||
import * as md from '../utils/markdown'; | ||
import { collapsibleSection } from '../utils/markdown'; | ||
const tableHeader = ['Name', 'Type', 'Duration', 'Count']; | ||
@@ -53,5 +54,13 @@ export const writeToMarkdown = async (filePath, data) => { | ||
result += `\n${buildDetailsTable(data.meaningless)}`; | ||
result += `\n\n${md.heading3('Changes To Count')}`; | ||
result += `\n${buildSummaryTable(data.countChanged)}`; | ||
result += `\n${buildDetailsTable(data.countChanged)}`; | ||
// Skip renders counts if user only has function measurements | ||
const allEntries = [...data.significant, ...data.meaningless, ...data.added, ...data.removed]; | ||
const hasRenderEntries = allEntries.some(e => e.type === 'render'); | ||
if (hasRenderEntries) { | ||
result += `\n\n${md.heading3('Render Count Changes')}`; | ||
result += `\n${buildSummaryTable(data.countChanged)}`; | ||
result += `\n${buildDetailsTable(data.countChanged)}`; | ||
result += `\n\n${md.heading3('Render Issues')}`; | ||
result += `\n${buildRedundantRendersTable(data.renderIssues)}`; | ||
} | ||
result += `\n\n${md.heading3('Added Scenarios')}`; | ||
@@ -82,4 +91,4 @@ result += `\n${buildSummaryTable(data.added)}`; | ||
function formatEntryDuration(entry) { | ||
if ('baseline' in entry && 'current' in entry) return formatDurationChange(entry); | ||
if ('baseline' in entry) return formatDuration(entry.baseline.meanDuration); | ||
if (entry.baseline != null && 'current' in entry) return formatDurationChange(entry); | ||
if (entry.baseline != null) return formatDuration(entry.baseline.meanDuration); | ||
if ('current' in entry) return formatDuration(entry.current.meanDuration); | ||
@@ -89,4 +98,4 @@ return ''; | ||
function formatEntryCount(entry) { | ||
if ('baseline' in entry && 'current' in entry) return formatCountChange(entry); | ||
if ('baseline' in entry) return formatCount(entry.baseline.meanCount); | ||
if (entry.baseline != null && 'current' in entry) return formatCountChange(entry.current.meanCount, entry.baseline.meanCount); | ||
if (entry.baseline != null) return formatCount(entry.baseline.meanCount); | ||
if ('current' in entry) return formatCount(entry.current.meanCount); | ||
@@ -96,6 +105,6 @@ return ''; | ||
function buildDurationDetailsEntry(entry) { | ||
return ['baseline' in entry ? buildDurationDetails('Baseline', entry.baseline) : '', 'current' in entry ? buildDurationDetails('Current', entry.current) : ''].filter(Boolean).join('<br/><br/>'); | ||
return [entry.baseline != null ? buildDurationDetails('Baseline', entry.baseline) : '', 'current' in entry ? buildDurationDetails('Current', entry.current) : ''].filter(Boolean).join('<br/><br/>'); | ||
} | ||
function buildCountDetailsEntry(entry) { | ||
return ['baseline' in entry ? buildCountDetails('Baseline', entry.baseline) : '', 'current' in entry ? buildCountDetails('Current', entry.current) : ''].filter(Boolean).join('<br/><br/>'); | ||
return [entry.baseline != null ? buildCountDetails('Baseline', entry.baseline) : '', 'current' in entry ? buildCountDetails('Current', entry.current) : ''].filter(Boolean).join('<br/><br/>'); | ||
} | ||
@@ -110,8 +119,21 @@ function buildDurationDetails(title, entry) { | ||
} | ||
export function collapsibleSection(title, content) { | ||
return `<details>\n<summary>${title}</summary>\n\n${content}\n</details>\n\n`; | ||
} | ||
export function formatRunDurations(values) { | ||
function formatRunDurations(values) { | ||
return values.map(v => Number.isInteger(v) ? `${v}` : `${v.toFixed(1)}`).join(' '); | ||
} | ||
function buildRedundantRendersTable(entries) { | ||
if (!entries.length) return md.italic('There are no entries'); | ||
const tableHeader = ['Name', 'Initial Updates', 'Redundant Updates']; | ||
const rows = entries.map(entry => [entry.name, formatInitialUpdates(entry.current.issues?.initialUpdateCount), formatRedundantUpdates(entry.current.issues?.redundantUpdates)]); | ||
return markdownTable([tableHeader, ...rows]); | ||
} | ||
function formatInitialUpdates(count) { | ||
if (count == null) return '?'; | ||
if (count === 0) return '-'; | ||
return `${count} 🔴`; | ||
} | ||
function formatRedundantUpdates(redundantUpdates) { | ||
if (redundantUpdates == null) return '?'; | ||
if (redundantUpdates.length === 0) return '-'; | ||
return `${redundantUpdates.length} (${redundantUpdates.join(', ')}) 🔴`; | ||
} | ||
//# sourceMappingURL=markdown.js.map |
@@ -36,4 +36,8 @@ import { z } from 'zod'; | ||
/** Array of measured render/execution counts for each run. */ | ||
counts: z.array(z.number()) | ||
counts: z.array(z.number()), | ||
issues: z.optional(z.object({ | ||
initialUpdateCount: z.number().optional(), | ||
redundantUpdates: z.array(z.number()).optional() | ||
})) | ||
}); | ||
//# sourceMappingURL=type-schemas.js.map |
@@ -29,9 +29,26 @@ import { buildRegExp, digit, repeat } from 'ts-regex-builder'; | ||
export function formatCount(value) { | ||
if (value == null) { | ||
return '?'; | ||
} | ||
return Number.isInteger(value) ? `${value}` : `${value.toFixed(2)}`; | ||
} | ||
export function formatCountDiff(value) { | ||
if (value > 0) return `+${value}`; | ||
if (value < 0) return `${value}`; | ||
export function formatCountDiff(current, baseline) { | ||
const diff = current - baseline; | ||
if (diff > 0) return `+${diff}`; | ||
if (diff < 0) return `${diff}`; | ||
return '±0'; | ||
} | ||
export function formatCountChange(current, baseline) { | ||
let output = `${formatCount(baseline)} → ${formatCount(current)}`; | ||
if (baseline != null && current != null && baseline !== current) { | ||
const parts = [formatCountDiff(current, baseline)]; | ||
if (baseline > 0) { | ||
const relativeDiff = (current - baseline) / baseline; | ||
parts.push(formatPercentChange(relativeDiff)); | ||
} | ||
output += ` (${parts.join(', ')})`; | ||
} | ||
output += ` ${getCountChangeSymbols(current, baseline)}`; | ||
return output; | ||
} | ||
export function formatChange(value) { | ||
@@ -66,19 +83,11 @@ if (value > 0) return `+${value}`; | ||
} | ||
export function formatCountChange(entry) { | ||
const { | ||
baseline, | ||
current | ||
} = entry; | ||
let output = `${formatCount(baseline.meanCount)} → ${formatCount(current.meanCount)}`; | ||
if (baseline.meanCount != current.meanCount) { | ||
output += ` (${formatCountDiff(entry.countDiff)}, ${formatPercentChange(entry.relativeCountDiff)})`; | ||
function getCountChangeSymbols(current, baseline) { | ||
if (current == null || baseline == null) { | ||
return ''; | ||
} | ||
output += ` ${getCountChangeSymbols(entry)}`; | ||
return output; | ||
} | ||
function getCountChangeSymbols(entry) { | ||
if (entry.countDiff > 1.5) return '🔴🔴'; | ||
if (entry.countDiff > 0.5) return '🔴'; | ||
if (entry.countDiff < -1.5) return '🟢🟢'; | ||
if (entry.countDiff < -0.5) return '🟢'; | ||
const diff = current - baseline; | ||
if (diff > 1.5) return '🔴🔴'; | ||
if (diff > 0.5) return '🔴'; | ||
if (diff < -1.5) return '🟢🟢'; | ||
if (diff < -0.5) return '🟢'; | ||
return ''; | ||
@@ -85,0 +94,0 @@ } |
@@ -16,2 +16,5 @@ export function heading1(text) { | ||
} | ||
export function collapsibleSection(title, content) { | ||
return `<details>\n<summary>${title}</summary>\n\n${content}\n</details>\n\n`; | ||
} | ||
//# sourceMappingURL=markdown.js.map |
import type { CompareResult } from '../types'; | ||
export declare function printToConsole(data: CompareResult): void; | ||
export declare function formatInitialUpdates(count: number): string; | ||
export declare function formatRedundantUpdates(redundantUpdates: number[]): string; | ||
//# sourceMappingURL=console.d.ts.map |
import type { CompareResult } from '../types'; | ||
export declare const writeToMarkdown: (filePath: string, data: CompareResult) => Promise<void>; | ||
export declare function collapsibleSection(title: string, content: string): string; | ||
export declare function formatRunDurations(values: number[]): string; | ||
//# sourceMappingURL=markdown.d.ts.map |
@@ -66,2 +66,12 @@ import { z } from 'zod'; | ||
counts: z.ZodArray<z.ZodNumber, "many">; | ||
issues: z.ZodOptional<z.ZodObject<{ | ||
initialUpdateCount: z.ZodOptional<z.ZodNumber>; | ||
redundantUpdates: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>; | ||
}, "strip", z.ZodTypeAny, { | ||
initialUpdateCount?: number | undefined; | ||
redundantUpdates?: number[] | undefined; | ||
}, { | ||
initialUpdateCount?: number | undefined; | ||
redundantUpdates?: number[] | undefined; | ||
}>>; | ||
}, "strip", z.ZodTypeAny, { | ||
@@ -78,2 +88,6 @@ type: "function" | "render"; | ||
warmupDurations?: number[] | undefined; | ||
issues?: { | ||
initialUpdateCount?: number | undefined; | ||
redundantUpdates?: number[] | undefined; | ||
} | undefined; | ||
}, { | ||
@@ -90,3 +104,7 @@ name: string; | ||
warmupDurations?: number[] | undefined; | ||
issues?: { | ||
initialUpdateCount?: number | undefined; | ||
redundantUpdates?: number[] | undefined; | ||
} | undefined; | ||
}>; | ||
//# sourceMappingURL=type-schemas.d.ts.map |
@@ -33,2 +33,3 @@ /** Parsed performance results file. */ | ||
current: MeasureEntry; | ||
baseline?: undefined; | ||
} | ||
@@ -53,2 +54,3 @@ /** | ||
countChanged: CompareEntry[]; | ||
renderIssues: Array<CompareEntry | AddedEntry>; | ||
added: AddedEntry[]; | ||
@@ -55,0 +57,0 @@ removed: RemovedEntry[]; |
@@ -9,8 +9,8 @@ import type { CompareEntry, MeasureMetadata } from '../types'; | ||
export declare function formatDurationDiff(value: number): string; | ||
export declare function formatCount(value: number): string; | ||
export declare function formatCountDiff(value: number): string; | ||
export declare function formatCount(value?: number): string; | ||
export declare function formatCountDiff(current: number, baseline: number): string; | ||
export declare function formatCountChange(current?: number, baseline?: number): string; | ||
export declare function formatChange(value: number): string; | ||
export declare function formatDurationChange(entry: CompareEntry): string; | ||
export declare function formatCountChange(entry: CompareEntry): string; | ||
export declare function formatMetadata(metadata?: MeasureMetadata): string; | ||
//# sourceMappingURL=format.d.ts.map |
@@ -6,2 +6,3 @@ export declare function heading1(text: string): string; | ||
export declare function italic(text: string): string; | ||
export declare function collapsibleSection(title: string, content: string): string; | ||
//# sourceMappingURL=markdown.d.ts.map |
{ | ||
"name": "@callstack/reassure-compare", | ||
"version": "1.0.0-rc.4", | ||
"version": "1.0.0-rc.5", | ||
"description": "Performance testing companion for React and React Native", | ||
@@ -38,3 +38,3 @@ "main": "lib/commonjs/index.js", | ||
"dependencies": { | ||
"@callstack/reassure-logger": "1.0.0-rc.4", | ||
"@callstack/reassure-logger": "1.0.0-rc.5", | ||
"markdown-table": "^2.0.0", | ||
@@ -41,0 +41,0 @@ "ts-regex-builder": "^1.7.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
171089
1659
+ Added@callstack/reassure-logger@1.0.0-rc.5(transitive)
- Removed@callstack/reassure-logger@1.0.0-rc.4(transitive)