From ca320e02ac0a46f6c5e7bfc0a43e572d247a5fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sat, 20 Feb 2021 21:17:26 +0100 Subject: [PATCH] refactor: simplify generate:manifest error handling Now that Ace correctly exits with code 1 on error, there is no need to check stderr. This also prevents us from interpreting output from deprecation warnings as manifest generation errors. --- src/Manifest/index.ts | 14 -------------- test/compiler.spec.ts | 4 ++-- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/Manifest/index.ts b/src/Manifest/index.ts index 3949ea85..dfdea24f 100644 --- a/src/Manifest/index.ts +++ b/src/Manifest/index.ts @@ -58,20 +58,6 @@ export class Manifest { }, }) - /** - * Print warning when `stderr` exists - */ - if (response.stderr) { - if (this.isMalformedJSONError(response.stderr) && this.attempts < this.maxAttempts) { - this.attempts++ - return this.generate() - } - - this.logger.warning(WARN_MESSAGE) - this.logger.logError(response.stderr) - return false - } - /** * Log success */ diff --git a/test/compiler.spec.ts b/test/compiler.spec.ts index 6e001815..3bef7c3a 100644 --- a/test/compiler.spec.ts +++ b/test/compiler.spec.ts @@ -606,7 +606,7 @@ test.group('Compiler', (group) => { assert.isTrue(hasPackageLock) }).timeout(0) - test('gracefully log error when ace file writes to stderr', async (assert) => { + test('gracefully log error when ace file finishes with non-zero exit code', async (assert) => { await fs.add( '.adonisrc.json', JSON.stringify({ @@ -624,7 +624,7 @@ test.group('Compiler', (group) => { }) ) - await fs.add('ace', "console.error('foo')") + await fs.add('ace', "console.error('foo');process.exit(1)") await fs.add('src/foo.ts', '') await fs.add('public/styles/main.css', '') await fs.add('public/scripts/main.js', '')