Skip to content
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

Attempt to Fix and Re-enable HasIncludedFiles Test #47220

Merged
merged 2 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>$(CurrentTargetFramework)</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<None Update="packfiles\pack1.txt" Pack="true" PackagePath="newpath/pack1.txt" />
<None Update="packfiles\pack2.txt" Pack="true" PackagePath="anotherpath/pack2.txt" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions test/TestAssets/TestProjects/EndToEndTestApp/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
Empty file.
Empty file.
7 changes: 3 additions & 4 deletions test/dotnet-pack.Tests/PackTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ public void SettingVersionSuffixFlag_ShouldStampAssemblyInfoInOutputAssemblyAndP
outputPackage.Should().Exist();
}

[Fact(Skip = "Test project missing")]
[Fact]
public void HasIncludedFiles()
{
var testInstance = _testAssetsManager.CopyTestAsset("EndToEndTestApp")
.WithSource();

new DotnetPackCommand(Log)
.WithWorkingDirectory(testInstance.Path)
.Execute()
.Execute("-c", "Debug")
Copy link
Member

Choose a reason for hiding this comment

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

Is the -c Debug part necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

By default, it appears to be the release path. Therefore, the debug configuration was used to ensure the correct file path.

.Should().Pass();

var outputPackage = new FileInfo(Path.Combine(testInstance.Path,
Expand All @@ -99,8 +99,7 @@ public void HasIncludedFiles()

ZipFile.Open(outputPackage.FullName, ZipArchiveMode.Read)
.Entries
.Should().Contain(e => e.FullName == "packfiles/pack1.txt")
.And.Contain(e => e.FullName == "newpath/pack2.txt")
.Should().Contain(e => e.FullName == "newpath/pack1.txt")
.And.Contain(e => e.FullName == "anotherpath/pack2.txt");
}

Expand Down