Skip to content

refactor(@angular/build): add debug logging to Vitest executor#32612

Open
clydin wants to merge 1 commit intoangular:mainfrom
clydin:vitest/debug-logging
Open

refactor(@angular/build): add debug logging to Vitest executor#32612
clydin wants to merge 1 commit intoangular:mainfrom
clydin:vitest/debug-logging

Conversation

@clydin
Copy link
Member

@clydin clydin commented Feb 26, 2026

This commit introduces a multi-level debug logging system within the Vitest test runner's executor. This logging is intended to aid in troubleshooting internal issues and provide deeper insights into the test execution process.

Logging is controlled by the NG_TEST_LOG environment variable, which accepts numeric levels (0 for off, 1 for debug, 2 for verbose). Crucial lifecycle events and state changes in the VitestExecutor are now logged, such as constructor instantiation, build result processing (full and incremental), test re-run specifications, Vitest initialization details (including browser configuration, external configuration path, and included files), and executor disposal. These logs are guarded by the logLevel to prevent any performance penalties during normal execution. Furthermore, specific areas like incremental run file mappings and external dependency metadata are logged at a verbose level.

@clydin clydin added the target: patch This PR is targeted for the next patch release label Feb 26, 2026
This commit introduces a multi-level debug logging system within the Vitest test runner's executor. This logging is intended to aid in troubleshooting internal issues and provide deeper insights into the test execution process.

Logging is controlled by the `NG_TEST_LOG` environment variable, which accepts numeric levels (0 for off, 1 for debug, 2 for verbose). Crucial lifecycle events and state changes in the `VitestExecutor` are now logged, such as constructor instantiation, build result processing (full and incremental), test re-run specifications, Vitest initialization details (including browser configuration, external configuration path, and included files), and executor disposal. These logs are guarded by the `logLevel` to prevent any performance penalties during normal execution. Furthermore, specific areas like incremental run file mappings and external dependency metadata are logged at a verbose level.
@clydin clydin force-pushed the vitest/debug-logging branch from e57821a to bae8feb Compare February 26, 2026 19:55
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Feb 26, 2026
@clydin clydin requested a review from alan-agius4 February 26, 2026 20:11
explicitBrowser: [],
explicitServer: [],
};
private readonly logLevel: number;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we switch from numbers to an enum?

Using numbers increases the cognitive load when parsing the file, as one has to mentally map numbers like 1 or 2 to their true meanings and an enum would make the logic self-documenting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: @angular/build target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants