DEV: Improve `ember test` (testem) output (#16401)

- Repeat failure output at end (similar to rspec)
- When running in GitHub actions, set a workflow error message
This commit is contained in:
David Taylor 2022-04-06 22:57:52 +01:00 committed by GitHub
parent 8e809149d2
commit ef2e4f7ee0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -6,6 +6,8 @@ class Reporter {
this._tapReporter = new TapReporter(...arguments);
}
failReports = [];
reportMetadata(tag, metadata) {
if (tag === "summary-line") {
process.stdout.write(`\n${metadata.message}\n`);
@ -15,11 +17,24 @@ class Reporter {
}
report(prefix, data) {
if (data.failed) {
this.failReports.push([prefix, data]);
}
this._tapReporter.report(prefix, data);
}
finish() {
this._tapReporter.finish();
if (this.failReports.length > 0) {
process.stdout.write("\nFailures:\n\n");
this.failReports.forEach(([prefix, data]) => {
if (process.env.GITHUB_ACTIONS) {
process.stdout.write(`::error ::QUnit Test Failure: ${data.name}\n`);
}
this.report(prefix, data);
});
}
}
}