diff --git a/TESTING_GUIDE.md b/TESTING_GUIDE.md index 56a8dad021..90f39433c2 100644 --- a/TESTING_GUIDE.md +++ b/TESTING_GUIDE.md @@ -50,6 +50,7 @@ The test project mirrors the production areas closely. publishes a trimmed RID-specific CLI and runs whichever entry point the SDK emits (`cdidx.dll` through `dotnet` or the native `cdidx`/`cdidx.exe` apphost). It is reported as skipped on macOS arm64 while SDK/ILLink can crash before exercising `cdidx` (#2586). Do not assume every SDK/runtime pair writes a `cdidx.dll` into self-contained publish output. - `QueryCommandRunnerTests.RunPublishedTrimmedCli_SearchSupportsCSharpRazorAliases` uses the same trimmed RID-specific publish path to verify C# Razor language aliases. It is also reported as skipped on macOS arm64 because the SDK/ILLink crash happens before the test reaches `cdidx`. + RID-specific publish helpers must route `NuGetLockFilePath` into the temporary publish output so local test runs do not add runtime sections to source `packages.lock.json` files (#2918). - `McpServerTests.cs` MCP JSON-RPC behavior and tool outputs. - `HttpMcpTransportTests.cs` @@ -250,6 +251,7 @@ dotnet test --filter "FullyQualifiedName~GitHelperTests" は trimmed な RID 固有 CLI を publish し、SDK が生成した entry point(`dotnet` 経由の `cdidx.dll`、または native の `cdidx`/`cdidx.exe` apphost)を実行します。self-contained publish output に常に `cdidx.dll` が出るとは仮定しないでください。 - `QueryCommandRunnerTests.RunPublishedTrimmedCli_SearchSupportsCSharpRazorAliases` は同じ trimmed RID 固有 publish 経路で C# Razor の言語 alias を検証します。このテストも macOS arm64 では、`cdidx` に到達する前に SDK/ILLink がクラッシュし得るため skipped として報告されます。 + RID 固有 publish helper は `NuGetLockFilePath` を一時 publish 出力へ向け、ローカル test run が source の `packages.lock.json` に runtime section を追加しないようにしてください (#2918)。 - `McpServerTests.cs` MCP の JSON-RPC 挙動とツール出力のテスト。 - `GitHelperTests.cs` diff --git a/changelog.d/unreleased/2918.fixed.md b/changelog.d/unreleased/2918.fixed.md new file mode 100644 index 0000000000..5d327e0c12 --- /dev/null +++ b/changelog.d/unreleased/2918.fixed.md @@ -0,0 +1,17 @@ +--- +category: fixed +issues: + - 2918 +affected: + - tests/CodeIndex.Tests/IndexCommandRunnerTests.cs + - tests/CodeIndex.Tests/QueryCommandRunnerTests.cs + - TESTING_GUIDE.md +--- + +## English + +- **Trimmed publish tests no longer dirty the source NuGet lock file on macOS (#2918)** - RID-specific test publishes now write their generated `packages.lock.json` to temporary publish output, so `dotnet test -p:UseSharedCompilation=false` no longer adds `net8.0/osx-arm64` to `src/CodeIndex/packages.lock.json`. + +## 日本語 + +- **trimmed publish テストが macOS で source の NuGet lock file を汚さないようになりました (#2918)** - RID 固有の test publish は生成される `packages.lock.json` を一時 publish 出力へ書くため、`dotnet test -p:UseSharedCompilation=false` が `src/CodeIndex/packages.lock.json` に `net8.0/osx-arm64` を追加しなくなりました。 diff --git a/tests/CodeIndex.Tests/IndexCommandRunnerTests.cs b/tests/CodeIndex.Tests/IndexCommandRunnerTests.cs index a42d65cc33..f458efe366 100644 --- a/tests/CodeIndex.Tests/IndexCommandRunnerTests.cs +++ b/tests/CodeIndex.Tests/IndexCommandRunnerTests.cs @@ -9028,6 +9028,8 @@ private static string PublishTrimmedCli(string outputDir) Directory.CreateDirectory(outputDir); var buildOutputDir = Path.Combine(outputDir, "bin", "publish") + Path.DirectorySeparatorChar; var intermediateDir = Path.Combine(outputDir, "obj", "publish") + Path.DirectorySeparatorChar; + Directory.CreateDirectory(intermediateDir); + var lockFilePath = Path.Combine(intermediateDir, "packages.lock.json"); var psi = new System.Diagnostics.ProcessStartInfo { @@ -9051,6 +9053,7 @@ private static string PublishTrimmedCli(string outputDir) psi.ArgumentList.Add("-p:PublishSingleFile=false"); psi.ArgumentList.Add($"-p:OutputPath={buildOutputDir}"); psi.ArgumentList.Add($"-p:IntermediateOutputPath={intermediateDir}"); + psi.ArgumentList.Add($"-p:NuGetLockFilePath={lockFilePath}"); psi.ArgumentList.Add("-p:UseSharedCompilation=false"); using var process = System.Diagnostics.Process.Start(psi) diff --git a/tests/CodeIndex.Tests/QueryCommandRunnerTests.cs b/tests/CodeIndex.Tests/QueryCommandRunnerTests.cs index 6bb46e74c5..88509cad4b 100644 --- a/tests/CodeIndex.Tests/QueryCommandRunnerTests.cs +++ b/tests/CodeIndex.Tests/QueryCommandRunnerTests.cs @@ -32553,6 +32553,8 @@ private static string PublishTrimmedCli(string outputDir) Directory.CreateDirectory(outputDir); var buildOutputDir = Path.Combine(outputDir, "bin", "publish") + Path.DirectorySeparatorChar; var intermediateDir = Path.Combine(outputDir, "obj", "publish") + Path.DirectorySeparatorChar; + Directory.CreateDirectory(intermediateDir); + var lockFilePath = Path.Combine(intermediateDir, "packages.lock.json"); var psi = new System.Diagnostics.ProcessStartInfo("dotnet") { @@ -32575,6 +32577,7 @@ private static string PublishTrimmedCli(string outputDir) psi.ArgumentList.Add("-p:PublishSingleFile=false"); psi.ArgumentList.Add($"-p:OutputPath={buildOutputDir}"); psi.ArgumentList.Add($"-p:IntermediateOutputPath={intermediateDir}"); + psi.ArgumentList.Add($"-p:NuGetLockFilePath={lockFilePath}"); psi.ArgumentList.Add("-p:UseSharedCompilation=false"); using var process = System.Diagnostics.Process.Start(psi)