Skip to content

Fix: surface the failing grunt task/error instead of the whole build transcript#262

Open
taylortom wants to merge 1 commit into
masterfrom
fix/build-error-surfacing
Open

Fix: surface the failing grunt task/error instead of the whole build transcript#262
taylortom wants to merge 1 commit into
masterfrom
fix/build-error-surfacing

Conversation

@taylortom

Copy link
Copy Markdown
Member

Fix

  • When a grunt build task fails, adaptBuild rejected with the entire grunt transcript as the error message (the >> Error: regex only matched grunt's own task warnings, so anything else — e.g. a rollup "Could not load …" failure from the javascript task, which prints a bare Error: line — fell through to dumping all of stdout). It now extracts just the salient failure: a >> Error: task message, else a bare Error: line, else the failing-task Warning: Task "…" failed line, falling back to full stdout only when none is present. The full transcript is preserved on error.stdout for debugging.

Testing

  1. Run a build whose javascript/rollup task fails (e.g. a module import that can't be resolved).
  2. The rejected error's .raw is now the concise root-cause line instead of the whole grunt transcript; .stdout still contains the full log.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves adaptBuild’s grunt failure reporting by extracting a concise, root-cause-oriented error string instead of rejecting with the entire grunt stdout transcript, while preserving the full stdout log on the error object for debugging.

Changes:

  • Update stdout parsing to prefer >> Error: task messages, then bare Error: lines, then Warning: Task "…" failed lines.
  • Attach the full stdout transcript to the thrown error (error.stdout) while keeping the concise message on error.raw.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +35 to +41
const matches = stdout.match(/>> Error:\s(.+)/) ||
stdout.match(/^Error:\s(.+)/m) ||
stdout.match(/(Warning: Task .+ failed)/);
const e = new Error('grunt tasks failed')
e.cmd = cmd;
e.raw = matches?.[1] ?? stdout;
e.stdout = stdout;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants