ci: add Node.js diagnostic reports for test crash investigation#321216
Merged
alexdima merged 10 commits intoJun 13, 2026
Conversation
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>
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @lszomoruMatched files:
|
Contributor
There was a problem hiding this comment.
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.reportin the Node.js unit test runner to write diagnostic reports to.build/crashes. - Add an
unhandledRejectionhandler to surface promise rejections in runner output. - Set
NODE_OPTIONSin 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
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
previously approved these changes
Jun 12, 2026
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>
TylerLeonhardt
approved these changes
Jun 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Build 447204 failed because the Node.js unit test runner crashed silently (exit code 1) during the
WebSocketNodeSocket > compressiontest suite. Unlike the Electron tests, the Node.js test runner had no crash diagnostics — no diagnostic report, no native stack trace, nounhandledRejectionhandler. The crash dump artifact was empty.Solution
Enable Node.js diagnostic reporting so future crashes produce actionable data:
test/unit/node/index.js: Configureprocess.reportto write JSON diagnostic reports to.build/crasheson fatal errors and uncaught exceptions. Add missingunhandledRejectionhandler.NODE_OPTIONSwith--report-on-fatalerror --report-uncaught-exception --report-directory=.build/crashesfor 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: