test(cli_util): guard sdkPath in unit tests for hermetic environments - #2552
Conversation
In hermetic test runners (such as Blaze/Bazel or environments without a standard Dart SDK layout on disk at Platform.resolvedExecutable), sdkPath evaluates to null. Guard the live SDK assertions so tests pass in hermetic sandboxes.
Package publishingIf you have publishing permissions, you can use the links below to publish the changes after merging this PR.
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
There was a problem hiding this comment.
Code Review
This pull request modifies the tests in cli_util_test.dart to conditionally execute assertions only when sdkPath is not null, replacing the previous non-null assertions. However, this change causes the tests to pass silently if sdkPath is null, potentially masking configuration issues. It is recommended to explicitly skip the tests using markTestSkipped instead of wrapping the test bodies in conditional blocks.
PR HealthUnused Dependencies ✔️
For details on how to fix these, see dependency_validator. This check can be disabled by tagging the PR with Breaking changes ✔️
This check can be disabled by tagging the PR with API leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
This check can be disabled by tagging the PR with Changelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with License Headers ✔️
All source files should start with a license header. Unrelated files missing license headers
This check can be disabled by tagging the PR with Coverage ✔️
This check for test coverage is informational (issues shown here will not fail the PR). This check can be disabled by tagging the PR with |
|
Needed so https://dart-review.googlesource.com/c/sdk/+/540220 doesn't blow up when we roll into google3 |
natebosch
left a comment
There was a problem hiding this comment.
I think needs a -wip version bump since it was already published?
In hermetic test runners (such as Blaze/Bazel or environments without
a standard Dart SDK layout on disk at Platform.resolvedExecutable),
sdkPath evaluates to null. Guard the live SDK assertions so tests pass
in hermetic sandboxes.