From ef2e4f7ee012cc54c344b0a120b836a4c95a2fd9 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Wed, 6 Apr 2022 22:57:52 +0100 Subject: [PATCH] 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 --- app/assets/javascripts/discourse/testem.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/assets/javascripts/discourse/testem.js b/app/assets/javascripts/discourse/testem.js index 8c5c5bf034c..3a55f8e7a57 100644 --- a/app/assets/javascripts/discourse/testem.js +++ b/app/assets/javascripts/discourse/testem.js @@ -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); + }); + } } }