From c8a8d717ce3cefed3b4ab202e1136e615952d3c5 Mon Sep 17 00:00:00 2001 From: Anne-Greeth Schot-van Herwijnen Date: Thu, 18 Apr 2024 17:17:42 +0200 Subject: [PATCH 1/2] Write errors as GitHub errors --- src/bin/generate.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/bin/generate.ts b/src/bin/generate.ts index 154a6e8..a4a6a10 100644 --- a/src/bin/generate.ts +++ b/src/bin/generate.ts @@ -109,6 +109,26 @@ async function main() { } main().catch(error => { + if (typeof error === 'string') { + github.setOutput('error', error); + } else if ('message' in error && typeof error.message === 'string') { + if ('stack' in error && typeof error.stack === 'string') { + if (error.stack.includes(error.message)) { + github.setOutput('error', error.stack); + } else { + github.setOutput('error', error.message + '\n' + error.stack); + } + } else { + github.setOutput('error', error.message); + } + } else { + try { + github.setOutput('error', JSON.stringify(error)); + } catch { + // ignore + } + } + console.error(error); process.exit(1); }); From d8ae5ec5c4a07371d858bd57931eccf340a28755 Mon Sep 17 00:00:00 2001 From: Anne-Greeth Schot-van Herwijnen Date: Thu, 18 Apr 2024 17:18:49 +0200 Subject: [PATCH 2/2] Add braking test to see if it works --- src/markdown/tutorial/part-1/03-automated-testing.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/markdown/tutorial/part-1/03-automated-testing.md b/src/markdown/tutorial/part-1/03-automated-testing.md index efde175..d354e2e 100644 --- a/src/markdown/tutorial/part-1/03-automated-testing.md +++ b/src/markdown/tutorial/part-1/03-automated-testing.md @@ -65,6 +65,7 @@ Let's open the generated test file and replace the boilerplate test with our own import { setupApplicationTest } from 'super-rentals/tests/helpers'; @@ -7,6 +7,12 @@ +fail!!! - test('visiting /super-rentals', async function (assert) { - await visit('/super-rentals'); -