Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/lib/report.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

const DOCS = 'https://evlog.dev'
const LOGO = 'https://www.evlog.dev/evlog.svg'
const ACTION = 'https://github.com/evloghq/action'

export function grade(score) {
Expand Down Expand Up @@ -84,7 +83,7 @@ export function verdict(results, { baselineRef } = {}) {
*/
export function renderReport(results, context) {
const lines = [
`### <img src="${LOGO}" height="18" alt=""> evlog map`,
'### Observability score',
'',
verdict(results, context),
'',
Expand Down Expand Up @@ -128,6 +127,6 @@ export function renderReport(results, context) {
lines.push('', '</details>')
}

lines.push('', `<sub>[evloghq/action](${ACTION}) · evlog map${context.cliVersion ? ` v${context.cliVersion}` : ''} · [how the score works](${DOCS}/cli/scoring) · [what each check expects](${DOCS}/cli/rules)</sub>`)
lines.push('', `<sub>Scored by [evlog map](${DOCS}/cli/map)${context.cliVersion ? ` v${context.cliVersion}` : ''} through [evloghq/action](${ACTION}): a static read of each entry point for the wide event, context and audit trail it should emit. [How the score works](${DOCS}/cli/scoring) · [what each check expects](${DOCS}/cli/rules)</sub>`)
return lines.join('\n')
}
7 changes: 4 additions & 3 deletions test/report.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ describe('verdict', () => {
describe('renderReport', () => {
it('writes one row per package and no delta column without a baseline', () => {
const md = renderReport([result(), result({ name: 'apps/api', framework: 'hono', score: 61 })], context)
assert.match(md, /^### <img src="https:\/\/www\.evlog\.dev\/evlog\.svg" height="18" alt=""> evlog map\n\n\*\*61\*\* needs work across 2 packages\n/)
assert.match(md, /<sub>\[evloghq\/action\]\(https:\/\/github\.com\/evloghq\/action\) · evlog map v0\.8\.0/)
assert.match(md, /^### Observability score\n\n\*\*61\*\* needs work across 2 packages\n/)
assert.doesNotMatch(md, /<img/)
assert.match(md, /<sub>Scored by \[evlog map\]\(https:\/\/evlog\.dev\/cli\/map\) v0\.8\.0 through \[evloghq\/action\]/)
assert.match(md, /\| Package \| Score \| Instrumented \| Partial \| Dark \| Gate \|/)
assert.match(md, /\| `shop` \(nuxt\) \| \*\*82\*\* good \| 3 \| 1 \| 1 \| passed \|/)
assert.match(md, /\| `apps\/api` \(hono\) \| \*\*61\*\* needs work /)
Expand Down Expand Up @@ -109,6 +110,6 @@ describe('renderReport', () => {
const md = renderReport([result({ routes: [route('/health', { score: 0, checks: { 'wide-event': 'fail' } })] })], { cliVersion: undefined })
assert.match(md, /`src\/x\.ts:1`: `wide-event`/)
assert.doesNotMatch(md, /github\.com\/acme/)
assert.match(md, /· evlog map · \[how/)
assert.match(md, /Scored by \[evlog map\]\(https:\/\/evlog\.dev\/cli\/map\) through/)
})
})
Loading