Skip to content

Avoid dirtying NuGet lock files in trimmed publish tests - #2941

Merged
Widthdom merged 2 commits into
mainfrom
fix-issue2918
Jun 2, 2026
Merged

Avoid dirtying NuGet lock files in trimmed publish tests#2941
Widthdom merged 2 commits into
mainfrom
fix-issue2918

Conversation

@Widthdom

@Widthdom Widthdom commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Redirect RID-specific trimmed test publishes to a temporary NuGetLockFilePath under the publish intermediate output.
  • Apply the same lock-file isolation to both trimmed publish test helpers.
  • Document the test helper convention and add a bilingual changelog fragment.

Validation

  • Reproduced the pre-fix dirty state with dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj --framework net8.0 --filter "FullyQualifiedName~QueryCommandRunnerTests.RunPublishedTrimmedCli_SerializesQueryJsonAndErrorJson" -p:UseSharedCompilation=false, which added net8.0/osx-arm64 to src/CodeIndex/packages.lock.json.
  • dotnet restore CodeIndex.sln --locked-mode
  • dotnet run --project tools/CodeIndex.Changelog -- check
  • dotnet format whitespace CodeIndex.sln --verify-no-changes --no-restore --verbosity minimal
  • dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj --framework net8.0 --filter "FullyQualifiedName~QueryCommandRunnerTests.RunPublishedTrimmedCli_SerializesQueryJsonAndErrorJson" -p:UseSharedCompilation=false
  • Verified git diff -- src/CodeIndex/packages.lock.json stayed empty after the fixed targeted test.
  • dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll status --check --json

Documentation / Changelog

  • Updated TESTING_GUIDE.md.
  • Added changelog.d/unreleased/2918.fixed.md.

Review

  • Codex adversarial review: no actionable regressions found.

Follow-up Candidates

None.

Fixes #2918

@Widthdom
Widthdom merged commit b0f50a0 into main Jun 2, 2026
10 checks passed
@Widthdom
Widthdom deleted the fix-issue2918 branch June 2, 2026 16:32
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.

dotnet test dirties packages.lock.json with RID-specific restore graph

1 participant