-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Don't create tool manifests in a .config subfolder by default #50242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
eab62eb
610c1b8
5c42f9d
9099124
8ad435c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -315,6 +315,26 @@ out ToolCommand restoredCommand | |
"But restore do not need to 'revert' since it just set in nuget global directory"); | ||
} | ||
|
||
[Fact] | ||
public void WhenRunWithExistingManifestInConfigDirectoryItShouldAddToExistingManifest() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot This test looks good, but can you add additional checks to it to verify that the manifest under the .config folder has been updated, and that no manifest exists in the root folder after the install command is run? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the requested checks to the test. The enhanced test now verifies:
All ToolInstallLocalCommandTests continue to pass, ensuring backward compatibility is maintained. Commit: 9099124 |
||
{ | ||
// Test backward compatibility: ensure tools can be added to existing manifests in .config directories | ||
_fileSystem.File.Delete(_manifestFilePath); | ||
var configDirectory = Path.Combine(_temporaryDirectory, ".config"); | ||
_fileSystem.Directory.CreateDirectory(configDirectory); | ||
var configManifestPath = Path.Combine(configDirectory, "dotnet-tools.json"); | ||
_fileSystem.File.WriteAllText(configManifestPath, _jsonContent); | ||
|
||
var toolInstallLocalCommand = GetDefaultTestToolInstallLocalCommand(); | ||
|
||
toolInstallLocalCommand.Execute().Should().Be(0); | ||
|
||
// Verify the tool was added to the existing .config manifest | ||
var manifestPackages = _toolManifestFinder.Find(); | ||
manifestPackages.Should().HaveCount(1); | ||
manifestPackages.First().PackageId.Should().Be(_packageIdA); | ||
} | ||
|
||
private ToolInstallLocalCommand GetDefaultTestToolInstallLocalCommand() | ||
{ | ||
return new ToolInstallLocalCommand( | ||
|
@@ -418,7 +438,7 @@ public void GivenNoManifestFileAndCreateManifestIfNeededFlagItShouldCreateManife | |
_reporter); | ||
|
||
installLocalCommand.Execute().Should().Be(0); | ||
_fileSystem.File.Exists(Path.Combine(_temporaryDirectory, ".config", "dotnet-tools.json")).Should().BeTrue(); | ||
_fileSystem.File.Exists(Path.Combine(_temporaryDirectory, "dotnet-tools.json")).Should().BeTrue(); | ||
} | ||
|
||
[Fact] | ||
|
@@ -440,7 +460,7 @@ public void GivenNoManifestFileItUsesCreateManifestIfNeededByDefault() | |
_reporter); | ||
|
||
installLocalCommand.Execute().Should().Be(0); | ||
_fileSystem.File.Exists(Path.Combine(_temporaryDirectory, ".config", "dotnet-tools.json")).Should().BeTrue(); | ||
_fileSystem.File.Exists(Path.Combine(_temporaryDirectory, "dotnet-tools.json")).Should().BeTrue(); | ||
} | ||
|
||
[Fact] | ||
|
@@ -465,7 +485,7 @@ public void GivenNoManifestFileAndCreateManifestIfNeededFlagItShouldCreateManife | |
_reporter); | ||
|
||
installLocalCommand.Execute().Should().Be(0); | ||
_fileSystem.File.Exists(Path.Combine(_temporaryDirectory, ".config", "dotnet-tools.json")).Should().BeTrue(); | ||
_fileSystem.File.Exists(Path.Combine(_temporaryDirectory, "dotnet-tools.json")).Should().BeTrue(); | ||
} | ||
|
||
[Fact] | ||
|
@@ -487,7 +507,7 @@ public void GivenNoManifestFileAndCreateManifestIfNeededFlagItShouldCreateManife | |
_reporter); | ||
|
||
installLocalCommand.Execute().Should().Be(0); | ||
_fileSystem.File.Exists(Path.Combine(_temporaryDirectory, ".config", "dotnet-tools.json")).Should().BeTrue(); | ||
_fileSystem.File.Exists(Path.Combine(_temporaryDirectory, "dotnet-tools.json")).Should().BeTrue(); | ||
} | ||
|
||
private IToolPackageDownloader GetToolToolPackageInstallerWithPreviewInFeed() | ||
|
Uh oh!
There was an error while loading. Please reload this page.