Skip to content

test(utils): report modern command failures instead of swallowing them - #8817

Open
keepview wants to merge 5 commits into
mainfrom
test/surface-modern-command-failures
Open

test(utils): report modern command failures instead of swallowing them#8817
keepview wants to merge 5 commits into
mainfrom
test/surface-modern-command-failures

Conversation

@keepview

Copy link
Copy Markdown
Contributor

Both spawn helpers hide why a command died:

  • runModernCommand resolves on any exit code unless stdout happened to contain 'Compile error', and callers do not check the resolved code, so a crashed modern build is indistinguishable from a successful one. The test then fails on a missing artifact, which points at the wrong place.
  • runContinuousTask never reads stderr at all, and resolves when the app closes before printing its ready marker. A dev server that fails to boot leaves no trace; the next assertion reports a connection refused.

Report the exit code and captured output in both cases. Neither change alters control flow: the promises settle exactly as before, so tests that expect a failing build are unaffected.

Summary

Related Links

Checklist

  • I have added changeset via pnpm run change.
  • I have updated the documentation.
  • I have added tests to cover my changes.

Both spawn helpers hide why a command died:

- runModernCommand resolves on any exit code unless stdout happened to
  contain 'Compile error', and callers do not check the resolved code, so
  a crashed `modern build` is indistinguishable from a successful one.
  The test then fails on a missing artifact, which points at the wrong
  place.
- runContinuousTask never reads stderr at all, and resolves when the app
  closes before printing its ready marker. A dev server that fails to
  boot leaves no trace; the next assertion reports a connection refused.

Report the exit code and captured output in both cases. Neither change
alters control flow: the promises settle exactly as before, so tests that
expect a failing build are unaffected.
@netlify

netlify Bot commented Aug 24, 2026

Copy link
Copy Markdown

Deploy Preview for modernjs-byted ready!

Name Link
🔨 Latest commit e91cae7
🔍 Latest deploy log https://app.netlify.com/projects/modernjs-byted/deploys/6a8c4ed79b31e0000873c533
😎 Deploy Preview https://deploy-preview-8817--modernjs-byted.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 99 (🟢 up 3 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@changeset-bot

changeset-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e91cae7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

📊 Quick Summary
Project Total Size Change
bundle-diff 472.5 KB 0

Generated by Rsdoctor GitHub Action

A dev/build failure surfaces as `SyntaxError: Unexpected token ')'` with
no file and no line: the CLI catches the loader error and re-logs only the
message, dropping the frame Node would have printed. Generated code is the
only input that differs per platform, so parse what was written under
`.modern-js` after a failure and let `node --check` report the offender.

The copy to a temp `.mjs` is deliberate: `node --check` treats a `.js`
file as CommonJS and silently accepts specifiers that only break under
module semantics, which is precisely the failure being chased.

Co-Authored-By: Riff
Only `.modern-js` was swept, which misses transpiled configs written to
`node_modules/.cache` — a likely home for the module that fails to parse.
Walk `node_modules` instead: installed packages are pnpm symlinks and
`isDirectory()` is false for those, so the walk covers what this run wrote
without descending into the store.

Co-Authored-By: Riff
node cannot parse JSX at all, so every generated .jsx file was reported as
broken — the sweep produced a false positive instead of a lead.

Co-Authored-By: Riff
Every fixture that fails is "type": "module", and every one that passes is
CommonJS — including tailwind v2/v3 passing in the same suite where v4
fails. A module project resolves the framework to dist/esm-node, a CommonJS
one to dist/cjs, and all the failures are the same SyntaxError raised while
node compiles an ES module. That points at the ESM build itself, which the
existing sweep never looked at.

Parse every published .mjs with vm.SourceTextModule (parse only, nothing is
linked or evaluated): 566 files in under 0.1s, so it can run on failure. It
names the file the loader refuses to.

Co-Authored-By: Riff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant