@empiricalrun/reporter
Advanced tools
Comparing version 0.1.1 to 0.1.2
# @empiricalrun/reporter | ||
## 0.1.2 | ||
### Patch Changes | ||
- 77dec1d: feat: add support for editing a scenario | ||
## 0.1.1 | ||
@@ -4,0 +10,0 @@ |
@@ -13,3 +13,3 @@ #!/usr/bin/env node | ||
success: "35a64f", | ||
error: "cb2431" | ||
error: "cb2431", | ||
}; | ||
@@ -29,3 +29,5 @@ function reportLink(repoName, runId, filter) { | ||
function testSummaryLink(previewText, repoName, runId, filter) { | ||
const link = filter ? reportLink(repoName, runId, { status: filter }) : reportLink(repoName, runId); | ||
const link = filter | ||
? reportLink(repoName, runId, { status: filter }) | ||
: reportLink(repoName, runId); | ||
return `<${link}|${previewText}>`; | ||
@@ -53,3 +55,5 @@ } | ||
} | ||
const failedAtThisLevel = specs.map((spec) => ({ ...spec, title: `${title} › ${spec.title}` })).filter(({ ok }) => !ok); | ||
const failedAtThisLevel = specs | ||
.map((spec) => ({ ...spec, title: `${title} › ${spec.title}` })) | ||
.filter(({ ok }) => !ok); | ||
return [...failedAtThisLevel, ...failedAtDeeperLevels]; | ||
@@ -88,7 +92,7 @@ } | ||
short: true, | ||
value: `<https://github.com/empirical-run/${repoName}-tests/actions/runs/${runId}|${runId}>` | ||
} | ||
] | ||
} | ||
] | ||
value: `<https://github.com/empirical-run/${repoName}-tests/actions/runs/${runId}|${runId}>`, | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
@@ -118,3 +122,3 @@ } | ||
short: true, | ||
value: `<https://github.com/empirical-run/${repoName}-tests/actions/runs/${runId}|${runId}>` | ||
value: `<https://github.com/empirical-run/${repoName}-tests/actions/runs/${runId}|${runId}>`, | ||
}, | ||
@@ -124,3 +128,3 @@ { | ||
short: true, | ||
value: `${results.stats.expected + results.stats.unexpected + results.stats.flaky} (${testSummaryLink("view", repoName, runId)})` | ||
value: `${results.stats.expected + results.stats.unexpected + results.stats.flaky} (${testSummaryLink("view", repoName, runId)})`, | ||
}, | ||
@@ -130,7 +134,7 @@ { | ||
short: true, | ||
value: humanReadable(results.stats.duration) | ||
value: humanReadable(results.stats.duration), | ||
}, | ||
] | ||
} | ||
] | ||
], | ||
}, | ||
], | ||
}; | ||
@@ -141,3 +145,3 @@ if (results.stats.flaky > 0) { | ||
short: true, | ||
value: `${results.stats.flaky} (${testSummaryLink("view", repoName, runId, 'flaky')})` | ||
value: `${results.stats.flaky} (${testSummaryLink("view", repoName, runId, "flaky")})`, | ||
}); | ||
@@ -151,7 +155,10 @@ } | ||
if (numFailed <= previewSizeLimit) { | ||
messageStr = failures.map(str => `- ${str}`).join('\n'); | ||
messageStr = failures.map((str) => `- ${str}`).join("\n"); | ||
} | ||
else { | ||
const testsStr = failures.slice(0, previewSizeLimit).map(str => `- ${str}`).join('\n'); | ||
messageStr = `${testsStr}\n${testSummaryLink("View all", repoName, runId, 'failed')}`; | ||
const testsStr = failures | ||
.slice(0, previewSizeLimit) | ||
.map((str) => `- ${str}`) | ||
.join("\n"); | ||
messageStr = `${testsStr}\n${testSummaryLink("View all", repoName, runId, "failed")}`; | ||
} | ||
@@ -161,3 +168,3 @@ slackMessage.attachments[0].fields.push({ | ||
short: false, | ||
value: messageStr | ||
value: messageStr, | ||
}); | ||
@@ -177,3 +184,3 @@ } | ||
short: true, | ||
value: "In Progress" | ||
value: "In Progress", | ||
}, | ||
@@ -183,7 +190,7 @@ { | ||
short: true, | ||
value: `<https://github.com/empirical-run/${repoName}-tests/actions/runs/${runId}|${runId}>` | ||
} | ||
] | ||
} | ||
] | ||
value: `<https://github.com/empirical-run/${repoName}-tests/actions/runs/${runId}|${runId}>`, | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
@@ -197,7 +204,7 @@ } | ||
const [messageType, repoName, runId] = process.argv.slice(2); | ||
if (messageType === 'start') { | ||
if (messageType === "start") { | ||
console.log(JSON.stringify(startMessage(repoName, runId))); | ||
return; | ||
} | ||
else if (messageType === 'end') { | ||
else if (messageType === "end") { | ||
console.log(JSON.stringify(endMessage(repoName, runId))); | ||
@@ -204,0 +211,0 @@ return; |
{ | ||
"name": "@empiricalrun/reporter", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"publishConfig": { | ||
@@ -25,6 +25,4 @@ "registry": "https://registry.npmjs.org/", | ||
"clean": "tsc --build --clean", | ||
"lint": "eslint .", | ||
"test": "vitest run", | ||
"test:watch": "vitest" | ||
"lint": "eslint ." | ||
} | ||
} |
@@ -5,3 +5,2 @@ # reporter | ||
## Usage | ||
@@ -17,4 +16,5 @@ | ||
Arguments | ||
- `$MESSAGE`: can be `start` (message for tests started) or `end` (message for tests completed) | ||
- `$CUSTOMERNAME`: name of the customer (e.g. leap-wallet) which resolves to *both* github and r2 | ||
- `$CUSTOMERNAME`: name of the customer (e.g. leap-wallet) which resolves to _both_ github and r2 | ||
- expected github: `github.com/empirical-run/$CUSTOMERNAME-tests` | ||
@@ -27,3 +27,3 @@ - expected r2 location: `reports.empirical.run/$CUSTOMERNAME/...` | ||
```sh | ||
pnpm build | ||
pnpm build | ||
@@ -30,0 +30,0 @@ cd packages/reporter |
9096
206