diff --git a/src/Cli/func/StaticResources/gitignore b/src/Cli/func/StaticResources/gitignore index e04adb7ca..0f45fa443 100644 --- a/src/Cli/func/StaticResources/gitignore +++ b/src/Cli/func/StaticResources/gitignore @@ -1,4 +1,6 @@ -bin +bin/ +**/bin/ +!Modules/** obj csx .vs diff --git a/test/Cli/Func.UnitTests/ParserTests/GitIgnoreParserTests.cs b/test/Cli/Func.UnitTests/ParserTests/GitIgnoreParserTests.cs index fda16c0a6..43119c42b 100644 --- a/test/Cli/Func.UnitTests/ParserTests/GitIgnoreParserTests.cs +++ b/test/Cli/Func.UnitTests/ParserTests/GitIgnoreParserTests.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. +using Azure.Functions.Cli; using Azure.Functions.Cli.Common; using FluentAssertions; using Xunit; @@ -147,5 +148,24 @@ public void DeniesShouldNotDenyNestedUnignoredFilesInIgnoredDirectories() { _gitignore.Denies("nonexistent/foo/wat").Should().BeFalse(); } + + [Fact] + public async void PowerShellModuleBinFoldersShouldBeHandledCorrectly() + { + // Test the current gitignore content from the actual static resource + var currentGitIgnore = await StaticResources.GitIgnore; + + var currentParser = new GitIgnoreParser(currentGitIgnore); + + // These paths should be ignored (regular bin folders) + currentParser.Denies("bin/somefile.dll").Should().BeTrue(); + currentParser.Denies("src/bin/output.dll").Should().BeTrue(); + + // These PowerShell module paths should NOT be ignored with the updated gitignore + currentParser.Denies("Modules/Az.Storage/8.1.0/Storage.Autorest/bin/Az.Storage.private.dll").Should().BeFalse("PowerShell module bin files should not be ignored"); + currentParser.Denies("Modules/SomeModule/1.0.0/bin/Module.dll").Should().BeFalse("PowerShell module bin files should not be ignored"); + + // Non-bin files in modules should not be ignored + currentParser.Denies("Modules/Az.Accounts/2.0.0/lib/netstandard2.0/Microsoft.Azure.dll").Should().BeFalse(); } }