Skip to content

ci: add Node.js diagnostic reports for test crash investigation#321216

Merged
alexdima merged 10 commits into
mainfrom
agents/could-you-please-take-a-look-at-https-910c8b18
Jun 13, 2026
Merged

ci: add Node.js diagnostic reports for test crash investigation#321216
alexdima merged 10 commits into
mainfrom
agents/could-you-please-take-a-look-at-https-910c8b18

Conversation

@alexdima

Copy link
Copy Markdown
Member

Problem

Build 447204 failed because the Node.js unit test runner crashed silently (exit code 1) during the WebSocketNodeSocket > compression test suite. Unlike the Electron tests, the Node.js test runner had no crash diagnostics — no diagnostic report, no native stack trace, no unhandledRejection handler. The crash dump artifact was empty.

Solution

Enable Node.js diagnostic reporting so future crashes produce actionable data:

  • test/unit/node/index.js: Configure process.report to write JSON diagnostic reports to .build/crashes on fatal errors and uncaught exceptions. Add missing unhandledRejection handler.
  • CI pipeline steps (win32, linux, darwin): Set NODE_OPTIONS with --report-on-fatalerror --report-uncaught-exception --report-directory=.build/crashes for belt-and-suspenders coverage of crashes during Node startup.

The reports are automatically picked up by the existing crash-dump-* artifact collection in the pipeline.

What diagnostic reports contain

When Node.js crashes, the report includes:

  • Native (C/C++) stack trace
  • JavaScript stack trace (if available)
  • Heap statistics and system info
  • Loaded native modules and shared libraries

Enable Node.js diagnostic reporting for the node.js unit test runner
so that native crashes (like the zlib crash in build 447204) produce
actionable diagnostic reports instead of a silent exit code 1.

Changes:
- Configure process.report in test/unit/node/index.js to write JSON
  diagnostic reports to .build/crashes on fatal errors and uncaught
  exceptions
- Add unhandledRejection handler (was missing, unlike Electron tests)
- Set NODE_OPTIONS in CI pipeline steps (win32, linux, darwin) with
  --report-on-fatalerror and --report-uncaught-exception flags
- Reports are picked up by the existing crash-dump artifact collection

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 12, 2026 21:04
@vs-code-engineering

vs-code-engineering Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@lszomoru

Matched files:

  • build/azure-pipelines/darwin/steps/product-build-darwin-test.yml
  • build/azure-pipelines/linux/steps/product-build-linux-test.yml
  • build/azure-pipelines/win32/steps/product-build-win32-test.yml

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves diagnosability of crashes in VS Code’s Node.js unit test runner by enabling Node’s diagnostic report generation and wiring the CI pipeline to turn it on consistently, so failures that currently show up as a silent exit code 1 can produce actionable crash artifacts under .build/crashes.

Changes:

  • Configure process.report in the Node.js unit test runner to write diagnostic reports to .build/crashes.
  • Add an unhandledRejection handler to surface promise rejections in runner output.
  • Set NODE_OPTIONS in win32/linux/darwin test pipeline steps to enable reports even for early-startup crashes.
Show a summary per file
File Description
test/unit/node/index.js Enables Node diagnostic reports and adds a rejection handler for improved crash visibility in node unit tests.
build/azure-pipelines/win32/steps/product-build-win32-test.yml Sets NODE_OPTIONS to enable Node diagnostic reports during node unit tests on Windows.
build/azure-pipelines/linux/steps/product-build-linux-test.yml Sets NODE_OPTIONS to enable Node diagnostic reports during node unit tests on Linux.
build/azure-pipelines/darwin/steps/product-build-darwin-test.yml Sets NODE_OPTIONS to enable Node diagnostic reports during node unit tests on macOS.

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 6

Comment thread test/unit/node/index.js Outdated
Comment thread test/unit/node/index.js
Comment thread test/unit/node/index.js
Comment thread build/azure-pipelines/linux/steps/product-build-linux-test.yml Outdated
Comment thread build/azure-pipelines/darwin/steps/product-build-darwin-test.yml Outdated
Comment thread build/azure-pipelines/win32/steps/product-build-win32-test.yml Outdated
alexdima and others added 7 commits June 12, 2026 23:40
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
The uncaughtException handler intentionally does NOT exit — it logs
the error and lets Mocha continue running. The test suite has a
dedicated 'Errors' suite that asserts on collected unexpected errors
at the end. Calling process.exit(1) kills the test runner on the
first uncaught exception, failing all Electron tests on all platforms.

Keep the writeReport() calls for diagnostic purposes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dmitrivMS
dmitrivMS previously approved these changes Jun 12, 2026
alexdima and others added 2 commits June 13, 2026 01:45
The manual writeReport() calls fire on benign unhandled rejections
(e.g. Canceled errors during test teardown in UserDataSyncService)
and block the event loop writing JSON reports to disk, causing
subsequent faked-timer tests to exceed their 2000ms timeout.

Report generation is already handled by process.report config and
NODE_OPTIONS flags (--report-on-fatalerror, --report-uncaught-exception)
which only fire on actual fatal errors, not on every caught rejection.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@alexdima alexdima merged commit bf2334e into main Jun 13, 2026
49 checks passed
@alexdima alexdima deleted the agents/could-you-please-take-a-look-at-https-910c8b18 branch June 13, 2026 08:42
@vs-code-engineering vs-code-engineering Bot added this to the 1.125.0 milestone Jun 13, 2026
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.

4 participants