From 6ceec22664b2d0fa077bfe79898e403a2d7709ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Sun, 19 Apr 2020 16:03:40 +0200 Subject: [PATCH] Move sources to new structure Move files to new structure and merge them into one file during build --- .DS_Store | Bin 8196 -> 0 bytes .gitignore | 2 - .travis.yml | 4 +- Functions/Coverage.Plugin.ps1 | 22 --- Functions/Pester.SafeCommands.ps1 | 118 -------------- LICENSE | 2 +- README.md | 8 +- bin/pester.bat | 34 ---- build.ps1 | 71 ++++++++ CHANGELOG.md => docs/CHANGELOG.md | 0 .../Examples}/Planets/Get-Planet.Tests.ps1 | 0 .../Examples}/Planets/Get-Planet.ps1 | 0 {images => docs/images}/logo.png | Bin {images => docs/images}/pester.PNG | Bin .../images}/pester_blue_darker.pdf | Bin .../images}/pester_blue_lighter.pdf | Bin .../images}/pester_white_with_text.pdf | Bin {images => docs/images}/readme/gitter-64.PNG | Bin {images => docs/images}/readme/jacoco.PNG | Bin .../images}/readme/minimal-output.gif | Bin {images => docs/images}/readme/output.PNG | Bin .../images}/readme/pshorg-85x64.PNG | Bin .../images}/readme/single-test.gif | Bin {images => docs/images}/readme/slack-64.PNG | Bin .../images}/readme/stack-overflow-64.PNG | Bin {images => docs/images}/readme/twitter-64.PNG | Bin en-US/RSpec.psd1 | 33 ---- new-runtimepoc/Pester.Types.ps1 | 9 -- Pester.nuspec => publish/Pester.nuspec | 0 .../buildNugetPackage.ps1 | 0 .../buildPSGalleryPackage.ps1 | 0 .../chocolateyInstall.ps1 | 0 .../cleanUpBeforeBuild.ps1 | 0 getNugetExe.ps1 => publish/getNugetExe.ps1 | 0 .../publishPSGalleryPackage.ps1 | 0 release.ps1 => publish/release.ps1 | 0 signModule.ps1 => publish/signModule.ps1 | 0 testRelease.ps1 => publish/testRelease.ps1 | 0 {vendor => publish/vendor}/packages.config | 0 {vendor => publish/vendor}/tools/nuget.exe | Bin {Dependencies/Format => src}/Format.psm1 | 7 +- {new-runtimepoc => src}/Pester.RSpec.ps1 | 2 +- {new-runtimepoc => src}/Pester.Runtime.psm1 | 12 +- src/Pester.State.ps1 | 4 + src/Pester.Types.ps1 | 33 ++++ {new-runtimepoc => src}/Pester.Utility.ps1 | 18 +-- Pester.psm1 => src/Pester.ps1 | 122 +------------- Pester.psd1 => src/Pester.psd1 | 0 src/Pester.psm1 | 50 ++++++ .../TypeClass => src}/TypeClass.psm1 | 0 .../csharp}/Configuration.cs | 0 .../csharp}/ConversionTests.cs | 0 {new-runtimepoc => src/csharp}/Factory.cs | 4 + {new-runtimepoc => src/csharp}/Pester.csproj | 0 src/csharp/Pester.sln | 25 +++ {new-runtimepoc => src/csharp}/Test.cs | 0 .../about_BeforeEach_AfterEach.help.txt | 0 {en-US => src/en-US}/about_Mocking.help.txt | 0 {en-US => src/en-US}/about_Pester.help.txt | 0 {en-US => src/en-US}/about_Should.help.txt | 0 {en-US => src/en-US}/about_TestDrive.help.txt | 0 {Functions => src/functions}/Context.ps1 | 2 +- src/functions/Coverage.Plugin.ps1 | 47 ++++++ {Functions => src/functions}/Coverage.ps1 | 29 ++-- {Functions => src/functions}/Describe.ps1 | 0 {Functions => src/functions}/Environment.ps1 | 0 .../functions}/Get-ShouldOperator.ps1 | 0 {Functions => src/functions}/In.ps1 | 0 .../functions}/InModuleScope.ps1 | 0 {Functions => src/functions}/It.ps1 | 0 {Functions => src/functions}/Mock.ps1 | 0 .../functions}/New-MockObject.ps1 | 0 {Functions => src/functions}/Output.ps1 | 30 +--- .../functions}/Pester.Debugging.ps1 | 0 src/functions/Pester.SafeCommands.ps1 | 107 +++++++++++++ .../functions}/Pester.Scoping.ps1 | 0 .../functions}/Pester.SessionState.Mock.ps1 | 2 +- {Functions => src/functions}/PesterState.ps1 | 0 {Functions => src/functions}/Set-ItResult.ps1 | 0 .../functions}/SetupTeardown.ps1 | 8 +- {Functions => src/functions}/TestDrive.ps1 | 2 +- {Functions => src/functions}/TestRegistry.ps1 | 0 {Functions => src/functions}/TestResults.ps1 | 0 .../functions/assertions}/Be.ps1 | 4 +- .../functions/assertions}/BeGreaterThan.ps1 | 0 .../functions/assertions}/BeIn.ps1 | 0 .../functions/assertions}/BeLessThan.ps1 | 0 .../functions/assertions}/BeLike.ps1 | 0 .../functions/assertions}/BeLikeExactly.ps1 | 0 .../functions/assertions}/BeNullOrEmpty.ps1 | 0 .../functions/assertions}/BeOfType.ps1 | 0 .../functions/assertions}/BeTrueOrFalse.ps1 | 0 .../functions/assertions}/Contain.ps1 | 0 .../functions/assertions}/Exist.ps1 | 0 .../assertions}/FileContentMatch.ps1 | 0 .../assertions}/FileContentMatchExactly.ps1 | 0 .../assertions}/FileContentMatchMultiline.ps1 | 0 .../functions/assertions}/HaveCount.ps1 | 0 .../functions/assertions}/HaveParameter.ps1 | 0 .../functions/assertions}/Match.ps1 | 0 .../functions/assertions}/MatchExactly.ps1 | 0 .../functions/assertions}/PesterThrow.ps1 | 0 .../functions/assertions}/Should.ps1 | 0 .../nunit_schema_2.5.xsd | 0 report.dtd => src/report.dtd | 0 test.ps1 | 73 +++++++-- {Dependencies/Format => tst}/Format.Tests.ps1 | 32 ++-- .../Pester.Mock.RSpec.ts.ps1 | 4 +- .../Pester.RSpec.Configuration.ts.ps1 | 20 +-- .../Pester.RSpec.Demo.ts.ps1 | 4 +- .../Pester.RSpec.Nunit.TestResults.ts.ps1 | 4 +- .../Pester.RSpec.Pester4ResultObject.ts.ps1 | 4 +- .../Pester.RSpec.ResultObject.ts.ps1 | 4 +- {new-runtimepoc => tst}/Pester.RSpec.ts.ps1 | 4 +- .../Pester.Rspec.Filtering.ts.ps1 | 4 +- .../Pester.Runtime.ResultObject.ts.ps1 | 6 +- {new-runtimepoc => tst}/Pester.Runtime.ts.ps1 | 6 +- Pester.Tests.ps1 => tst/Pester.Tests.ps1 | 14 +- {new-runtimepoc => tst}/Pester.Utility.ts.ps1 | 4 +- .../ReloadAndInvokePester.ps1 | 0 .../TypeClass => tst}/TypeClass.Tests.ps1 | 10 +- {Dependencies/Axiom => tst/axiom}/Axiom.psm1 | 0 .../axiom}/Verify-AssertionFailed.ps1 | 0 .../Axiom => tst/axiom}/Verify-Equal.ps1 | 0 .../Axiom => tst/axiom}/Verify-False.ps1 | 0 .../Axiom => tst/axiom}/Verify-NotNull.ps1 | 0 .../Axiom => tst/axiom}/Verify-NotSame.ps1 | 0 .../Axiom => tst/axiom}/Verify-Null.ps1 | 0 .../Axiom => tst/axiom}/Verify-Same.ps1 | 0 .../Axiom => tst/axiom}/Verify-Throw.ps1 | 0 .../Axiom => tst/axiom}/Verify-True.ps1 | 0 .../Axiom => tst/axiom}/Verify-Type.ps1 | 0 .../functions}/BreakAndContinue.Tests.ps1 | 0 .../functions}/Context.Tests.ps1 | 0 .../functions}/Coverage.Tests.ps1 | 20 +-- .../functions}/Describe.Tests.ps1 | 2 +- .../functions}/Environment.Tests.ps1 | 0 .../functions}/Get-ShouldOperator.Tests.ps1 | 2 +- .../functions}/GlobalMock-A.Tests.ps1 | 0 .../functions}/GlobalMock-B.Tests.ps1 | 0 {Functions => tst/functions}/In.Tests.ps1 | 2 +- .../functions}/InModuleScope.Tests.ps1 | 0 {Functions => tst/functions}/It.Tests.ps1 | 4 +- {Functions => tst/functions}/Mock.Tests.ps1 | 16 +- .../functions}/New-MockObject.Tests.ps1 | 0 .../functions}/OuterMock.Tests.ps1 | 0 {Functions => tst/functions}/Output.Tests.ps1 | 18 ++- .../functions}/PesterState.Tests.ps1 | 2 +- .../functions}/Set-ItResult.Tests.ps1 | 0 .../functions}/SetupTeardown.Tests.ps1 | 2 +- .../functions}/TestDrive.Tests.ps1 | 5 +- .../functions}/TestRegistry.Tests.ps1 | 0 .../functions}/TestResults.Tests.ps1 | 2 +- .../TestsRunningInCleanRunspace.Tests.ps1 | 0 .../functions/assertions}/Be.Tests.ps1 | 4 +- .../assertions}/BeGreaterThan.Tests.ps1 | 2 +- .../functions/assertions}/BeIn.Tests.ps1 | 2 +- .../assertions}/BeLessThan.Tests.ps1 | 2 +- .../functions/assertions}/BeLike.Tests.ps1 | 2 +- .../assertions}/BeLikeExactly.Tests.ps1 | 2 +- .../assertions}/BeNullOrEmpty.Tests.ps1 | 2 +- .../functions/assertions}/BeOfType.Tests.ps1 | 2 +- .../assertions}/BeTrueOrFalse.Tests.ps1 | 2 +- .../functions/assertions}/Contain.Tests.ps1 | 2 +- .../functions/assertions}/Exist.Tests.ps1 | 2 +- .../assertions}/FileContentMatch.Tests.ps1 | 2 +- .../FileContentMatchExactly.Tests.ps1 | 2 +- .../FileContentMatchMultiline.Tests.ps1 | 2 +- .../functions/assertions}/HaveCount.Tests.ps1 | 2 +- .../assertions}/HaveParameter.Tests.ps1 | 151 +++++++++--------- .../functions/assertions}/Match.Tests.ps1 | 2 +- .../assertions}/MatchExactly.Tests.ps1 | 2 +- .../assertions}/PesterThrow.Tests.ps1 | 2 +- .../functions/assertions}/Should.Tests.ps1 | 2 +- {new-runtimepoc => tst}/p.psm1 | 0 .../BasicTests/folder1/file1.Tests.ps1 | 2 + .../BasicTests/folder2/file1.Tests.ps1 | 2 + 177 files changed, 659 insertions(+), 615 deletions(-) delete mode 100644 .DS_Store delete mode 100644 Functions/Coverage.Plugin.ps1 delete mode 100644 Functions/Pester.SafeCommands.ps1 delete mode 100644 bin/pester.bat create mode 100644 build.ps1 rename CHANGELOG.md => docs/CHANGELOG.md (100%) rename {Examples => docs/Examples}/Planets/Get-Planet.Tests.ps1 (100%) rename {Examples => docs/Examples}/Planets/Get-Planet.ps1 (100%) rename {images => docs/images}/logo.png (100%) rename {images => docs/images}/pester.PNG (100%) rename {images => docs/images}/pester_blue_darker.pdf (100%) rename {images => docs/images}/pester_blue_lighter.pdf (100%) rename {images => docs/images}/pester_white_with_text.pdf (100%) rename {images => docs/images}/readme/gitter-64.PNG (100%) rename {images => docs/images}/readme/jacoco.PNG (100%) rename {images => docs/images}/readme/minimal-output.gif (100%) rename {images => docs/images}/readme/output.PNG (100%) rename {images => docs/images}/readme/pshorg-85x64.PNG (100%) rename {images => docs/images}/readme/single-test.gif (100%) rename {images => docs/images}/readme/slack-64.PNG (100%) rename {images => docs/images}/readme/stack-overflow-64.PNG (100%) rename {images => docs/images}/readme/twitter-64.PNG (100%) delete mode 100644 en-US/RSpec.psd1 delete mode 100644 new-runtimepoc/Pester.Types.ps1 rename Pester.nuspec => publish/Pester.nuspec (100%) rename buildNugetPackage.ps1 => publish/buildNugetPackage.ps1 (100%) rename buildPSGalleryPackage.ps1 => publish/buildPSGalleryPackage.ps1 (100%) rename chocolateyInstall.ps1 => publish/chocolateyInstall.ps1 (100%) rename cleanUpBeforeBuild.ps1 => publish/cleanUpBeforeBuild.ps1 (100%) rename getNugetExe.ps1 => publish/getNugetExe.ps1 (100%) rename publishPSGalleryPackage.ps1 => publish/publishPSGalleryPackage.ps1 (100%) rename release.ps1 => publish/release.ps1 (100%) rename signModule.ps1 => publish/signModule.ps1 (100%) rename testRelease.ps1 => publish/testRelease.ps1 (100%) rename {vendor => publish/vendor}/packages.config (100%) rename {vendor => publish/vendor}/tools/nuget.exe (100%) rename {Dependencies/Format => src}/Format.psm1 (97%) rename {new-runtimepoc => src}/Pester.RSpec.ps1 (99%) rename {new-runtimepoc => src}/Pester.Runtime.psm1 (99%) create mode 100644 src/Pester.State.ps1 create mode 100644 src/Pester.Types.ps1 rename {new-runtimepoc => src}/Pester.Utility.ps1 (95%) rename Pester.psm1 => src/Pester.ps1 (87%) rename Pester.psd1 => src/Pester.psd1 (100%) create mode 100644 src/Pester.psm1 rename {Dependencies/TypeClass => src}/TypeClass.psm1 (100%) rename {new-runtimepoc => src/csharp}/Configuration.cs (100%) rename {new-runtimepoc => src/csharp}/ConversionTests.cs (100%) rename {new-runtimepoc => src/csharp}/Factory.cs (87%) rename {new-runtimepoc => src/csharp}/Pester.csproj (100%) create mode 100644 src/csharp/Pester.sln rename {new-runtimepoc => src/csharp}/Test.cs (100%) rename {en-US => src/en-US}/about_BeforeEach_AfterEach.help.txt (100%) rename {en-US => src/en-US}/about_Mocking.help.txt (100%) rename {en-US => src/en-US}/about_Pester.help.txt (100%) rename {en-US => src/en-US}/about_Should.help.txt (100%) rename {en-US => src/en-US}/about_TestDrive.help.txt (100%) rename {Functions => src/functions}/Context.ps1 (94%) create mode 100644 src/functions/Coverage.Plugin.ps1 rename {Functions => src/functions}/Coverage.ps1 (97%) rename {Functions => src/functions}/Describe.ps1 (100%) rename {Functions => src/functions}/Environment.ps1 (100%) rename {Functions => src/functions}/Get-ShouldOperator.ps1 (100%) rename {Functions => src/functions}/In.ps1 (100%) rename {Functions => src/functions}/InModuleScope.ps1 (100%) rename {Functions => src/functions}/It.ps1 (100%) rename {Functions => src/functions}/Mock.ps1 (100%) rename {Functions => src/functions}/New-MockObject.ps1 (100%) rename {Functions => src/functions}/Output.ps1 (93%) rename {Functions => src/functions}/Pester.Debugging.ps1 (100%) create mode 100644 src/functions/Pester.SafeCommands.ps1 rename {Functions => src/functions}/Pester.Scoping.ps1 (100%) rename {Functions => src/functions}/Pester.SessionState.Mock.ps1 (99%) rename {Functions => src/functions}/PesterState.ps1 (100%) rename {Functions => src/functions}/Set-ItResult.ps1 (100%) rename {Functions => src/functions}/SetupTeardown.ps1 (92%) rename {Functions => src/functions}/TestDrive.ps1 (98%) rename {Functions => src/functions}/TestRegistry.ps1 (100%) rename {Functions => src/functions}/TestResults.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/Be.ps1 (98%) rename {Functions/Assertions => src/functions/assertions}/BeGreaterThan.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/BeIn.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/BeLessThan.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/BeLike.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/BeLikeExactly.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/BeNullOrEmpty.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/BeOfType.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/BeTrueOrFalse.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/Contain.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/Exist.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/FileContentMatch.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/FileContentMatchExactly.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/FileContentMatchMultiline.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/HaveCount.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/HaveParameter.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/Match.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/MatchExactly.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/PesterThrow.ps1 (100%) rename {Functions/Assertions => src/functions/assertions}/Should.ps1 (100%) rename nunit_schema_2.5.xsd => src/nunit_schema_2.5.xsd (100%) rename report.dtd => src/report.dtd (100%) rename {Dependencies/Format => tst}/Format.Tests.ps1 (87%) rename {new-runtimepoc => tst}/Pester.Mock.RSpec.ts.ps1 (98%) rename {new-runtimepoc => tst}/Pester.RSpec.Configuration.ts.ps1 (95%) rename {new-runtimepoc => tst}/Pester.RSpec.Demo.ts.ps1 (98%) rename {new-runtimepoc => tst}/Pester.RSpec.Nunit.TestResults.ts.ps1 (99%) rename {new-runtimepoc => tst}/Pester.RSpec.Pester4ResultObject.ts.ps1 (97%) rename {new-runtimepoc => tst}/Pester.RSpec.ResultObject.ts.ps1 (98%) rename {new-runtimepoc => tst}/Pester.RSpec.ts.ps1 (99%) rename {new-runtimepoc => tst}/Pester.Rspec.Filtering.ts.ps1 (98%) rename {new-runtimepoc => tst}/Pester.Runtime.ResultObject.ts.ps1 (97%) rename {new-runtimepoc => tst}/Pester.Runtime.ts.ps1 (99%) rename Pester.Tests.ps1 => tst/Pester.Tests.ps1 (97%) rename {new-runtimepoc => tst}/Pester.Utility.ts.ps1 (95%) rename {new-runtimepoc => tst}/ReloadAndInvokePester.ps1 (100%) rename {Dependencies/TypeClass => tst}/TypeClass.Tests.ps1 (95%) rename {Dependencies/Axiom => tst/axiom}/Axiom.psm1 (100%) rename {Dependencies/Axiom => tst/axiom}/Verify-AssertionFailed.ps1 (100%) rename {Dependencies/Axiom => tst/axiom}/Verify-Equal.ps1 (100%) rename {Dependencies/Axiom => tst/axiom}/Verify-False.ps1 (100%) rename {Dependencies/Axiom => tst/axiom}/Verify-NotNull.ps1 (100%) rename {Dependencies/Axiom => tst/axiom}/Verify-NotSame.ps1 (100%) rename {Dependencies/Axiom => tst/axiom}/Verify-Null.ps1 (100%) rename {Dependencies/Axiom => tst/axiom}/Verify-Same.ps1 (100%) rename {Dependencies/Axiom => tst/axiom}/Verify-Throw.ps1 (100%) rename {Dependencies/Axiom => tst/axiom}/Verify-True.ps1 (100%) rename {Dependencies/Axiom => tst/axiom}/Verify-Type.ps1 (100%) rename {Functions => tst/functions}/BreakAndContinue.Tests.ps1 (100%) rename {Functions => tst/functions}/Context.Tests.ps1 (100%) rename {Functions => tst/functions}/Coverage.Tests.ps1 (98%) rename {Functions => tst/functions}/Describe.Tests.ps1 (99%) rename {Functions => tst/functions}/Environment.Tests.ps1 (100%) rename {Functions => tst/functions}/Get-ShouldOperator.Tests.ps1 (98%) rename {Functions => tst/functions}/GlobalMock-A.Tests.ps1 (100%) rename {Functions => tst/functions}/GlobalMock-B.Tests.ps1 (100%) rename {Functions => tst/functions}/In.Tests.ps1 (96%) rename {Functions => tst/functions}/InModuleScope.Tests.ps1 (100%) rename {Functions => tst/functions}/It.Tests.ps1 (97%) rename {Functions => tst/functions}/Mock.Tests.ps1 (99%) rename {Functions => tst/functions}/New-MockObject.Tests.ps1 (100%) rename {Functions => tst/functions}/OuterMock.Tests.ps1 (100%) rename {Functions => tst/functions}/Output.Tests.ps1 (95%) rename {Functions => tst/functions}/PesterState.Tests.ps1 (99%) rename {Functions => tst/functions}/Set-ItResult.Tests.ps1 (100%) rename {Functions => tst/functions}/SetupTeardown.Tests.ps1 (99%) rename {Functions => tst/functions}/TestDrive.Tests.ps1 (98%) rename {Functions => tst/functions}/TestRegistry.Tests.ps1 (100%) rename {Functions => tst/functions}/TestResults.Tests.ps1 (99%) rename {Functions => tst/functions}/TestsRunningInCleanRunspace.Tests.ps1 (100%) rename {Functions/Assertions => tst/functions/assertions}/Be.Tests.ps1 (99%) rename {Functions/Assertions => tst/functions/assertions}/BeGreaterThan.Tests.ps1 (99%) rename {Functions/Assertions => tst/functions/assertions}/BeIn.Tests.ps1 (98%) rename {Functions/Assertions => tst/functions/assertions}/BeLessThan.Tests.ps1 (99%) rename {Functions/Assertions => tst/functions/assertions}/BeLike.Tests.ps1 (98%) rename {Functions/Assertions => tst/functions/assertions}/BeLikeExactly.Tests.ps1 (98%) rename {Functions/Assertions => tst/functions/assertions}/BeNullOrEmpty.Tests.ps1 (98%) rename {Functions/Assertions => tst/functions/assertions}/BeOfType.Tests.ps1 (98%) rename {Functions/Assertions => tst/functions/assertions}/BeTrueOrFalse.Tests.ps1 (99%) rename {Functions/Assertions => tst/functions/assertions}/Contain.Tests.ps1 (98%) rename {Functions/Assertions => tst/functions/assertions}/Exist.Tests.ps1 (98%) rename {Functions/Assertions => tst/functions/assertions}/FileContentMatch.Tests.ps1 (98%) rename {Functions/Assertions => tst/functions/assertions}/FileContentMatchExactly.Tests.ps1 (98%) rename {Functions/Assertions => tst/functions/assertions}/FileContentMatchMultiline.Tests.ps1 (98%) rename {Functions/Assertions => tst/functions/assertions}/HaveCount.Tests.ps1 (99%) rename {Functions/Assertions => tst/functions/assertions}/HaveParameter.Tests.ps1 (86%) rename {Functions/Assertions => tst/functions/assertions}/Match.Tests.ps1 (98%) rename {Functions/Assertions => tst/functions/assertions}/MatchExactly.Tests.ps1 (98%) rename {Functions/Assertions => tst/functions/assertions}/PesterThrow.Tests.ps1 (99%) rename {Functions/Assertions => tst/functions/assertions}/Should.Tests.ps1 (99%) rename {new-runtimepoc => tst}/p.psm1 (100%) rename {new-runtimepoc/TestProjects => tst/testProjects}/BasicTests/folder1/file1.Tests.ps1 (80%) rename {new-runtimepoc/TestProjects => tst/testProjects}/BasicTests/folder2/file1.Tests.ps1 (82%) diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index de28fec2a4c12b84eb3f1272d07e7a89398e1e41..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHLUu+ab7@w~#FuPDXE&aDwpeIKKrD%)LGV{%R z^L;b>{pPnbJ4*}dQVsVee`*~iJN_@>Slz{%k&ZcxTg{|wU>>}$x z5g-sC5FijB5FijB@Lxax&upIP66e0x8D#*^5C2|QPno-6oQ4Dj4hANK8HzMS!-=T5-Ce1JbQ_%{@AXUFlw zt~r62CxbFTAV6R-0{re?N)%#}bZTP${ax2=r={gvC@C#lwtNMpA{EQUK|vXb$g;PB(|AqS2P-@b<^rrl$p3*VMYN`($SF+|>E$r(g8~0)JB= z6$=8qG#8zg&ij8S;Nw)*i|z-;3h@cz%2nm7D_CXKn#$_Rn%bJW`WmUKVeKeelakY? z$1VP(9j0ztaXqJwvI-kx?@pUWpQYw8&ZMKBbrRY+?5bMea70y3%&Gb(vuIO2r*H>- z!ctXZc-+#I-mx)Tb&`CBv}NjgpJ{83W*S5DdWS~b*&Q|0ZH$>XBY%S4EH|@{s+Ns% zk$-YXwk+8gSL2h%bvdQ#y++)095a*DFbe+U?gWXfoYsu-$m4fBD1}IDvsYszQb0En z^LJaypx=-)Dq5ZNIwP?j--?ngq@5(l2suM$$SdR>a+O>oUy+~4Z{$xXhg#SGTc8bZUm#t`C6#2!Bzb{cAQ#E&BG+J@1T`^0=X<4M$D`p16+ R1n2+!@6_P@zfaHqzW@j4&>sK* diff --git a/.gitignore b/.gitignore index 3eaad88c6..0ae7152f9 100644 --- a/.gitignore +++ b/.gitignore @@ -177,8 +177,6 @@ DocProject/Help/*.hhp DocProject/Help/Html2 DocProject/Help/html -# Click-Once directory -publish/ # Publish Web Output *.[Pp]ublish.xml diff --git a/.travis.yml b/.travis.yml index 2344db2b4..72b29c749 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,13 +9,13 @@ matrix: # - brew tap caskroom/cask - brew cask install powershell - os: linux - dist: trusty + dist: bionic # VM-based builds turned out to be faster sudo: required addons: apt: sources: - - sourceline: deb [arch=amd64] https://packages.microsoft.com/ubuntu/14.04/prod trusty main + - sourceline: deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/prod bionic main key_url: https://packages.microsoft.com/keys/microsoft.asc packages: - powershell diff --git a/Functions/Coverage.Plugin.ps1 b/Functions/Coverage.Plugin.ps1 deleted file mode 100644 index cc67fcca6..000000000 --- a/Functions/Coverage.Plugin.ps1 +++ /dev/null @@ -1,22 +0,0 @@ -function Get-CoveragePlugin { - New-PluginObject -Name "Coverage" -Start { - param($Context) - $config = $Context.Configuration['Coverage'] - $breakpoints = Enter-CoverageAnalysis -CodeCoverage $config - $Context.GlobalPluginData.Add('Coverage', @{ - CommandCoverage = $breakpoints - CoverageReport = $null - }) - } -End { - param($Context) - - if (-not $Context.TestRun.PluginData.ContainsKey("Coverage")) { - return - } - - $coverageData = $Context.TestRun.PluginData.Coverage - $breakpoints = $coverageData.CommandCoverage - - Exit-CoverageAnalysis -CommandCoverage $breakpoints - } -} diff --git a/Functions/Pester.SafeCommands.ps1 b/Functions/Pester.SafeCommands.ps1 deleted file mode 100644 index 925d73254..000000000 --- a/Functions/Pester.SafeCommands.ps1 +++ /dev/null @@ -1,118 +0,0 @@ -if ($PSVersionTable.PSVersion.Major -ge 3) { - $script:IgnoreErrorPreference = 'Ignore' - $outNullModule = 'Microsoft.PowerShell.Core' - $outHostModule = 'Microsoft.PowerShell.Core' -} -else { - $script:IgnoreErrorPreference = 'SilentlyContinue' - $outNullModule = 'Microsoft.PowerShell.Utility' - $outHostModule = $null -} - -# Tried using $ExecutionState.InvokeCommand.GetCmdlet() here, but it does not trigger module auto-loading the way -# Get-Command does. Since this is at import time, before any mocks have been defined, that's probably acceptable. -# If someone monkeys with Get-Command before they import Pester, they may break something. - -# The -All parameter is required when calling Get-Command to ensure that PowerShell can find the command it is -# looking for. Otherwise, if you have modules loaded that define proxy cmdlets or that have cmdlets with the same -# name as the safe cmdlets, Get-Command will return null. -$safeCommandLookupParameters = @{ - CommandType = [System.Management.Automation.CommandTypes]::Cmdlet - ErrorAction = [System.Management.Automation.ActionPreference]::Stop -} - -if ($PSVersionTable.PSVersion.Major -gt 2) { - $safeCommandLookupParameters['All'] = $true -} - -$script:SafeCommands = @{ - 'Add-Member' = Get-Command -Name Add-Member -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Add-Type' = Get-Command -Name Add-Type -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Compare-Object' = Get-Command -Name Compare-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Export-ModuleMember' = Get-Command -Name Export-ModuleMember -Module Microsoft.PowerShell.Core @safeCommandLookupParameters - 'ForEach-Object' = Get-Command -Name ForEach-Object -Module Microsoft.PowerShell.Core @safeCommandLookupParameters - 'Format-Table' = Get-Command -Name Format-Table -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Get-Alias' = Get-Command -Name Get-Alias -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Get-ChildItem' = Get-Command -Name Get-ChildItem -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'Get-Command' = Get-Command -Name Get-Command -Module Microsoft.PowerShell.Core @safeCommandLookupParameters - 'Get-Content' = Get-Command -Name Get-Content -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'Get-Date' = Get-Command -Name Get-Date -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Get-Item' = Get-Command -Name Get-Item -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'Get-ItemProperty' = Get-Command -Name Get-ItemProperty -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'Get-Location' = Get-Command -Name Get-Location -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'Get-Member' = Get-Command -Name Get-Member -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Get-Module' = Get-Command -Name Get-Module -Module Microsoft.PowerShell.Core @safeCommandLookupParameters - 'Get-PSDrive' = Get-Command -Name Get-PSDrive -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'Get-PSCallStack' = Get-Command -Name Get-PSCallStack -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Get-Unique' = Get-Command -Name Get-Unique -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Get-Variable' = Get-Command -Name Get-Variable -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Group-Object' = Get-Command -Name Group-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Import-LocalizedData' = Get-Command -Name Import-LocalizedData -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Import-Module' = Get-Command -Name Import-Module -Module Microsoft.PowerShell.Core @safeCommandLookupParameters - 'Join-Path' = Get-Command -Name Join-Path -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'Measure-Object' = Get-Command -Name Measure-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'New-Item' = Get-Command -Name New-Item -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'New-ItemProperty' = Get-Command -Name New-ItemProperty -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'New-Module' = Get-Command -Name New-Module -Module Microsoft.PowerShell.Core @safeCommandLookupParameters - 'New-Object' = Get-Command -Name New-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'New-PSDrive' = Get-Command -Name New-PSDrive -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'New-Variable' = Get-Command -Name New-Variable -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Out-Host' = Get-Command -Name Out-Host -Module $outHostModule @safeCommandLookupParameters - 'Out-File' = Get-Command -Name Out-File -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Out-Null' = Get-Command -Name Out-Null -Module $outNullModule @safeCommandLookupParameters - 'Out-String' = Get-Command -Name Out-String -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Pop-Location' = Get-Command -Name Pop-Location -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'Push-Location' = Get-Command -Name Push-Location -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'Remove-Item' = Get-Command -Name Remove-Item -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'Remove-PSBreakpoint' = Get-Command -Name Remove-PSBreakpoint -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Remove-PSDrive' = Get-Command -Name Remove-PSDrive -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'Remove-Variable' = Get-Command -Name Remove-Variable -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Resolve-Path' = Get-Command -Name Resolve-Path -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'Select-Object' = Get-Command -Name Select-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Set-Alias' = Get-Command -Name Set-Alias -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Set-Content' = Get-Command -Name Set-Content -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'Set-Location' = Get-Command -Name Set-Location -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'Set-PSBreakpoint' = Get-Command -Name Set-PSBreakpoint -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Set-StrictMode' = Get-Command -Name Set-StrictMode -Module Microsoft.PowerShell.Core @safeCommandLookupParameters - 'Set-Variable' = Get-Command -Name Set-Variable -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Sort-Object' = Get-Command -Name Sort-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Split-Path' = Get-Command -Name Split-Path -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'Start-Sleep' = Get-Command -Name Start-Sleep -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Test-Path' = Get-Command -Name Test-Path -Module Microsoft.PowerShell.Management @safeCommandLookupParameters - 'Where-Object' = Get-Command -Name Where-Object -Module Microsoft.PowerShell.Core @safeCommandLookupParameters - 'Write-Error' = Get-Command -Name Write-Error -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Write-Host' = Get-Command -Name Write-Host -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Write-Progress' = Get-Command -Name Write-Progress -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Write-Verbose' = Get-Command -Name Write-Verbose -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters - 'Write-Warning' = Get-Command -Name Write-Warning -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters -} - -# Not all platforms have Get-WmiObject (Nano or PSCore 6.0.0-beta.x on Linux) -# Get-CimInstance is preferred, but we can use Get-WmiObject if it exists -# Moreover, it shouldn't really be fatal if neither of those cmdlets -# exist -if ( Get-Command -ea SilentlyContinue Get-CimInstance ) { - $script:SafeCommands['Get-CimInstance'] = Get-Command -Name Get-CimInstance -Module CimCmdlets @safeCommandLookupParameters -} -elseif ( Get-command -ea SilentlyContinue Get-WmiObject ) { - $script:SafeCommands['Get-WmiObject'] = Get-Command -Name Get-WmiObject -Module Microsoft.PowerShell.Management @safeCommandLookupParameters -} -elseif ( Get-Command -ea SilentlyContinue uname -Type Application ) { - $script:SafeCommands['uname'] = Get-Command -Name uname -Type Application | Select-Object -First 1 - if ( Get-Command -ea SilentlyContinue id -Type Application ) { - $script:SafeCommands['id'] = Get-Command -Name id -Type Application | Select-Object -First 1 - } -} -else { - Write-Warning "OS Information retrieval is not possible, reports will contain only partial system data" -} - -# little sanity check to make sure we don't blow up a system with a typo up there -# (not that I've EVER done that by, for example, mapping New-Item to Remove-Item...) - -foreach ($keyValuePair in $script:SafeCommands.GetEnumerator()) { - if ($keyValuePair.Key -ne $keyValuePair.Value.Name) { - throw "SafeCommands entry for $($keyValuePair.Key) does not hold a reference to the proper command." - } -} - diff --git a/LICENSE b/LICENSE index 924d9f5ac..d2e27fe20 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2011 Scott Muc and Manoj Mahalingam +Copyright 2020 Pester team Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index db380845b..92fdb6c83 100644 --- a/README.md +++ b/README.md @@ -420,12 +420,12 @@ Starting test discovery in 1 files. Test discovery finished. 83ms [-] minimal output.fails 24ms (18ms|5ms) Expected 2, but got 1. - at 1 | Should -Be 2, C:\Projects\pester\new-runtimepoc\Pester.RSpec.Demo.ts.ps1:289 - at , C:\Projects\pester\new-runtimepoc\Pester.RSpec.Demo.ts.ps1:289 + at 1 | Should -Be 2, C:\Projects\pester\Pester.RSpec.Demo.ts.ps1:289 + at , C:\Projects\pester\Pester.RSpec.Demo.ts.ps1:289 [-] minimal output.child.fails 22ms (16ms|5ms) Expected 2, but got 1. - at 1 | Should -Be 2, C:\Projects\pester\new-runtimepoc\Pester.RSpec.Demo.ts.ps1:298 - at , C:\Projects\pester\new-runtimepoc\Pester.RSpec.Demo.ts.ps1:298 + at 1 | Should -Be 2, C:\Projects\pester\Pester.RSpec.Demo.ts.ps1:298 + at , C:\Projects\pester\Pester.RSpec.Demo.ts.ps1:298 Tests completed in 331ms Tests Passed: 4, Failed: 2, Skipped: 0, Total: 6, NotRun: 0 ``` diff --git a/bin/pester.bat b/bin/pester.bat deleted file mode 100644 index a103714e8..000000000 --- a/bin/pester.bat +++ /dev/null @@ -1,34 +0,0 @@ -@echo off -SET DIR=%~dp0% -SET ARGS=%* -if NOT '%1'=='' SET ARGS=%ARGS:"=\"% -if '%1'=='/?' goto usage -if '%1'=='-?' goto usage -if '%1'=='?' goto usage -if '%1'=='/help' goto usage -if '%1'=='help' goto usage - -@PowerShell -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command ^ - "& Import-Module '%DIR%..\Pester.psd1'; & { Invoke-Pester -ExcludeTag VersionChecks, StyleRules, Help -ExcludePath '*/demo/*' -CI %ARGS%}" - -goto finish -:usage -if NOT '%2'=='' goto help - -echo To run pester for tests, just call pester or runtests with no arguments -echo. -echo Example: pester -echo. -echo For Detailed help information, call pester help with a help topic. See -echo help topic about_Pester for a list of all topics at the end -echo. -echo Example: pester help about_Pester -echo. -goto finish - -:help -@PowerShell -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command ^ - "& Import-Module '%DIR%..\Pester.psd1'; & { Get-Help %2}" - -:finish -exit /B %errorlevel% diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 000000000..0192f43a1 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,71 @@ +$ErrorActionPreference = 'Stop' +Get-Module Pester | Remove-Module +if (Test-Path "$PSScriptRoot/bin") { + Remove-Item "$PSScriptRoot/bin" -Recurse -Force +} +$null = New-Item "$PSScriptRoot/bin" -ItemType Directory -Force + +$script = @( + "$PSScriptRoot/src/functions/Pester.SafeCommands.ps1" + "$PSScriptRoot/src/Pester.Types.ps1" + "$PSScriptRoot/src/Pester.State.ps1" + "$PSScriptRoot/src/Pester.Utility.ps1" + "$PSScriptRoot/src/Pester.Runtime.psm1" + "$PSScriptRoot/src/TypeClass.psm1" + "$PSScriptRoot/src/Format.psm1" + "$PSScriptRoot/src/Pester.RSpec.ps1" + "$PSScriptRoot/src/Pester.ps1" + + "$PSScriptRoot/src/functions/assertions/*" + "$PSScriptRoot/src/functions/*" + + "$PSScriptRoot/src/Pester.psm1" + # "$PSScriptRoot/src/" + # "$PSScriptRoot/src/" +) + +$sb = [System.Text.StringBuilder]"" +foreach ($s in $script) { + foreach ($f in Get-ChildItem $s -File) { + $lines = Get-Content $f + + $relativePath = ($f.FullName -replace ([regex]::Escape($PSScriptRoot))).TrimStart('\').TrimStart('/') + $null = $sb.AppendLine("# file $relativePath") + $noBuild = $false + foreach ($l in $lines) { + if ($l -match "^\s*#\s*if\s*-not\s*build\s*$") { + $noBuild = $true + } + + if (-not $noBuild) { + $null = $sb.AppendLine($l) + } + + if ($l -match "#\s*endif\s*$") { + $noBuild = $false + } + } + } +} + +$sb.ToString() | Set-Content $PSScriptRoot/bin/Pester.psm1 -Encoding UTF8 + + +$content = @( + ,("$PSScriptRoot/src/csharp/*.cs","$PSScriptRoot/bin/csharp/") + ,("$PSScriptRoot/src/en-US/*.txt","$PSScriptRoot/bin/en-US/") + ,("$PSScriptRoot/src/nunit_schema_2.5.xsd", "$PSScriptRoot/bin/") + ,("$PSScriptRoot/src/report.dtd", "$PSScriptRoot/bin/") + ,("$PSScriptRoot/src/Pester.psd1", "$PSScriptRoot/bin/") +) + +foreach ($c in $content) { + $source, $destination = $c + + $null = New-Item -Force $destination -ItemType Directory + + Get-ChildItem $source -File | Copy-Item -Destination $destination +} + + +Import-Module $PSScriptRoot/bin/Pester.psm1 -ErrorAction Stop diff --git a/CHANGELOG.md b/docs/CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to docs/CHANGELOG.md diff --git a/Examples/Planets/Get-Planet.Tests.ps1 b/docs/Examples/Planets/Get-Planet.Tests.ps1 similarity index 100% rename from Examples/Planets/Get-Planet.Tests.ps1 rename to docs/Examples/Planets/Get-Planet.Tests.ps1 diff --git a/Examples/Planets/Get-Planet.ps1 b/docs/Examples/Planets/Get-Planet.ps1 similarity index 100% rename from Examples/Planets/Get-Planet.ps1 rename to docs/Examples/Planets/Get-Planet.ps1 diff --git a/images/logo.png b/docs/images/logo.png similarity index 100% rename from images/logo.png rename to docs/images/logo.png diff --git a/images/pester.PNG b/docs/images/pester.PNG similarity index 100% rename from images/pester.PNG rename to docs/images/pester.PNG diff --git a/images/pester_blue_darker.pdf b/docs/images/pester_blue_darker.pdf similarity index 100% rename from images/pester_blue_darker.pdf rename to docs/images/pester_blue_darker.pdf diff --git a/images/pester_blue_lighter.pdf b/docs/images/pester_blue_lighter.pdf similarity index 100% rename from images/pester_blue_lighter.pdf rename to docs/images/pester_blue_lighter.pdf diff --git a/images/pester_white_with_text.pdf b/docs/images/pester_white_with_text.pdf similarity index 100% rename from images/pester_white_with_text.pdf rename to docs/images/pester_white_with_text.pdf diff --git a/images/readme/gitter-64.PNG b/docs/images/readme/gitter-64.PNG similarity index 100% rename from images/readme/gitter-64.PNG rename to docs/images/readme/gitter-64.PNG diff --git a/images/readme/jacoco.PNG b/docs/images/readme/jacoco.PNG similarity index 100% rename from images/readme/jacoco.PNG rename to docs/images/readme/jacoco.PNG diff --git a/images/readme/minimal-output.gif b/docs/images/readme/minimal-output.gif similarity index 100% rename from images/readme/minimal-output.gif rename to docs/images/readme/minimal-output.gif diff --git a/images/readme/output.PNG b/docs/images/readme/output.PNG similarity index 100% rename from images/readme/output.PNG rename to docs/images/readme/output.PNG diff --git a/images/readme/pshorg-85x64.PNG b/docs/images/readme/pshorg-85x64.PNG similarity index 100% rename from images/readme/pshorg-85x64.PNG rename to docs/images/readme/pshorg-85x64.PNG diff --git a/images/readme/single-test.gif b/docs/images/readme/single-test.gif similarity index 100% rename from images/readme/single-test.gif rename to docs/images/readme/single-test.gif diff --git a/images/readme/slack-64.PNG b/docs/images/readme/slack-64.PNG similarity index 100% rename from images/readme/slack-64.PNG rename to docs/images/readme/slack-64.PNG diff --git a/images/readme/stack-overflow-64.PNG b/docs/images/readme/stack-overflow-64.PNG similarity index 100% rename from images/readme/stack-overflow-64.PNG rename to docs/images/readme/stack-overflow-64.PNG diff --git a/images/readme/twitter-64.PNG b/docs/images/readme/twitter-64.PNG similarity index 100% rename from images/readme/twitter-64.PNG rename to docs/images/readme/twitter-64.PNG diff --git a/en-US/RSpec.psd1 b/en-US/RSpec.psd1 deleted file mode 100644 index 1b7414fc3..000000000 --- a/en-US/RSpec.psd1 +++ /dev/null @@ -1,33 +0,0 @@ -@{ - StartMessage = "Executing all tests in '{0}'" - FilterMessage = ' matching test name {0}' - TagMessage = ' with Tags {0}' - MessageOfs = "', '" - - CoverageTitle = 'Code coverage report:' - CoverageMessage = 'Covered {2:P2} of {3:N0} analyzed {0} in {4:N0} {1}.' - MissedSingular = 'Missed command:' - MissedPlural = 'Missed commands:' - CommandSingular = 'Command' - CommandPlural = 'Commands' - FileSingular = 'File' - FilePlural = 'Files' - - Describe = 'Describing {0}' - Script = 'Executing script {0}' - Context = 'Context {0}' - Margin = ' ' - Timing = 'Tests completed in {0}' - - # If this is set to an empty string, the count won't be printed - ContextsPassed = '' - ContextsFailed = '' - - TestsPassed = 'Tests Passed: {0}, ' - TestsFailed = 'Failed: {0}, ' - TestsSkipped = 'Skipped: {0}, ' - TestsPending = 'Pending: {0}, ' - TestsInconclusive = 'Inconclusive: {0}, ' - TestsTotal = 'Total: {0}, ' - TestsNotRun = 'NotRun: {0}' -} diff --git a/new-runtimepoc/Pester.Types.ps1 b/new-runtimepoc/Pester.Types.ps1 deleted file mode 100644 index 702aa77fc..000000000 --- a/new-runtimepoc/Pester.Types.ps1 +++ /dev/null @@ -1,9 +0,0 @@ -$Paths = @( - "$PSScriptRoot/Configuration.cs" - "$PSScriptRoot/Factory.cs" - "$PSScriptRoot/Test.cs" -) - -foreach ($path in $Paths) { - Add-Type -TypeDefinition (Get-Content -Raw $path) -ErrorAction Stop -} diff --git a/Pester.nuspec b/publish/Pester.nuspec similarity index 100% rename from Pester.nuspec rename to publish/Pester.nuspec diff --git a/buildNugetPackage.ps1 b/publish/buildNugetPackage.ps1 similarity index 100% rename from buildNugetPackage.ps1 rename to publish/buildNugetPackage.ps1 diff --git a/buildPSGalleryPackage.ps1 b/publish/buildPSGalleryPackage.ps1 similarity index 100% rename from buildPSGalleryPackage.ps1 rename to publish/buildPSGalleryPackage.ps1 diff --git a/chocolateyInstall.ps1 b/publish/chocolateyInstall.ps1 similarity index 100% rename from chocolateyInstall.ps1 rename to publish/chocolateyInstall.ps1 diff --git a/cleanUpBeforeBuild.ps1 b/publish/cleanUpBeforeBuild.ps1 similarity index 100% rename from cleanUpBeforeBuild.ps1 rename to publish/cleanUpBeforeBuild.ps1 diff --git a/getNugetExe.ps1 b/publish/getNugetExe.ps1 similarity index 100% rename from getNugetExe.ps1 rename to publish/getNugetExe.ps1 diff --git a/publishPSGalleryPackage.ps1 b/publish/publishPSGalleryPackage.ps1 similarity index 100% rename from publishPSGalleryPackage.ps1 rename to publish/publishPSGalleryPackage.ps1 diff --git a/release.ps1 b/publish/release.ps1 similarity index 100% rename from release.ps1 rename to publish/release.ps1 diff --git a/signModule.ps1 b/publish/signModule.ps1 similarity index 100% rename from signModule.ps1 rename to publish/signModule.ps1 diff --git a/testRelease.ps1 b/publish/testRelease.ps1 similarity index 100% rename from testRelease.ps1 rename to publish/testRelease.ps1 diff --git a/vendor/packages.config b/publish/vendor/packages.config similarity index 100% rename from vendor/packages.config rename to publish/vendor/packages.config diff --git a/vendor/tools/nuget.exe b/publish/vendor/tools/nuget.exe similarity index 100% rename from vendor/tools/nuget.exe rename to publish/vendor/tools/nuget.exe diff --git a/Dependencies/Format/Format.psm1 b/src/Format.psm1 similarity index 97% rename from Dependencies/Format/Format.psm1 rename to src/Format.psm1 index 792c45ebc..ed6ec9267 100644 --- a/Dependencies/Format/Format.psm1 +++ b/src/Format.psm1 @@ -1,4 +1,6 @@ -Import-Module $PSScriptRoot\..\TypeClass\TypeClass.psm1 -DisableNameChecking +# if -not build +Import-Module "$PSScriptRoot/TypeClass.psm1" -DisableNameChecking +# endif function Format-Collection ($Value, [switch]$Pretty) { $Limit = 10 @@ -186,7 +188,7 @@ function Format-Type ([Type]$Value) { [string]$Value } - +# if -not build Export-ModuleMember -Function @( 'Format-Collection' 'Format-Object' @@ -203,3 +205,4 @@ Export-ModuleMember -Function @( 'Get-DisplayProperty' 'Get-ShortType' ) +# endif diff --git a/new-runtimepoc/Pester.RSpec.ps1 b/src/Pester.RSpec.ps1 similarity index 99% rename from new-runtimepoc/Pester.RSpec.ps1 rename to src/Pester.RSpec.ps1 index f3eb00475..f6cbfffcd 100644 --- a/new-runtimepoc/Pester.RSpec.ps1 +++ b/src/Pester.RSpec.ps1 @@ -284,7 +284,7 @@ function PostProcess-RspecTestRun ($TestRun) { } function Get-RSpecObjectDecoratorPlugin () { - Pester.Runtime\New-PluginObject -Name "RSpecObjectDecoratorPlugin" ` + New-PluginObject -Name "RSpecObjectDecoratorPlugin" ` -EachTestTeardownEnd { param ($Context) diff --git a/new-runtimepoc/Pester.Runtime.psm1 b/src/Pester.Runtime.psm1 similarity index 99% rename from new-runtimepoc/Pester.Runtime.psm1 rename to src/Pester.Runtime.psm1 index a1ab8db23..60c7f53ce 100644 --- a/new-runtimepoc/Pester.Runtime.psm1 +++ b/src/Pester.Runtime.psm1 @@ -1,7 +1,10 @@ -. $PSScriptRoot\Pester.Utility.ps1 -. $PSScriptRoot\..\Functions\Pester.SafeCommands.ps1 -. $PSScriptRoot\Pester.Types.ps1 +# if -not build +. "$PSScriptRoot/Pester.Utility.ps1" +. "$PSScriptRoot/functions/Pester.SafeCommands.ps1" +. "$PSScriptRoot/Pester.Types.ps1" +# endif +# instances $flags = [System.Reflection.BindingFlags]'Instance,NonPublic' $script:SessionStateInternalProperty = [System.Management.Automation.SessionState].GetProperty('Internal', $flags) $script:ScriptBlockSessionStateInternalProperty = [System.Management.Automation.ScriptBlock].GetProperty('SessionStateInternal', $flags) @@ -2538,6 +2541,7 @@ function ConvertTo-HumanTime { # initialize internal state Reset-TestSuiteState +# if -not build Export-ModuleMember -Function @( # the core stuff I am mostly sure about 'Reset-TestSuiteState' @@ -2574,3 +2578,5 @@ Export-ModuleMember -Function @( 'New-PluginObject' 'New-BlockContainerObject' ) + +# endif diff --git a/src/Pester.State.ps1 b/src/Pester.State.ps1 new file mode 100644 index 000000000..8bcee99a8 --- /dev/null +++ b/src/Pester.State.ps1 @@ -0,0 +1,4 @@ +$script:AssertionOperators = [Collections.Generic.Dictionary[string,object]]([StringComparer]::InvariantCultureIgnoreCase) +$script:AssertionAliases = [Collections.Generic.Dictionary[string,object]]([StringComparer]::InvariantCultureIgnoreCase) +$script:AssertionDynamicParams = [Pester.Factory]::CreateRuntimeDefinedParameterDictionary() +$script:DisableScopeHints = $true diff --git a/src/Pester.Types.ps1 b/src/Pester.Types.ps1 new file mode 100644 index 000000000..f201f2f51 --- /dev/null +++ b/src/Pester.Types.ps1 @@ -0,0 +1,33 @@ +$Paths = @( + "$PSScriptRoot/csharp/Configuration.cs" + "$PSScriptRoot/csharp/Factory.cs" + "$PSScriptRoot/csharp/Test.cs" +) + +foreach ($path in $Paths) { + Add-Type -TypeDefinition (Get-Content -Raw $path) -ErrorAction Stop +} + +Add-Type -TypeDefinition @" +using System; +namespace Pester +{ + [Flags] + public enum OutputTypes + { + None = 0, + Default = 1, + Passed = 2, + Failed = 4, + Pending = 8, + Skipped = 16, + Inconclusive = 32, + Describe = 64, + Context = 128, + Summary = 256, + Header = 512, + All = Default | Passed | Failed | Pending | Skipped | Inconclusive | Describe | Context | Summary | Header, + Fails = Default | Failed | Pending | Skipped | Inconclusive | Describe | Context | Summary | Header + } +} +"@ diff --git a/new-runtimepoc/Pester.Utility.ps1 b/src/Pester.Utility.ps1 similarity index 95% rename from new-runtimepoc/Pester.Utility.ps1 rename to src/Pester.Utility.ps1 index f495db782..acdd051a0 100644 --- a/new-runtimepoc/Pester.Utility.ps1 +++ b/src/Pester.Utility.ps1 @@ -1,10 +1,3 @@ - -# TODO: Consider removing usage of Write-Host in favor of a solution that does not use any cmdlet -$_write_host = Get-Command -CommandType Cmdlet -Name Write-Host -# TODO: Remove this types import once this becomes just ps1 -. $PSScriptRoot/Pester.Types.ps1 - - function or { [CmdletBinding()] param ( @@ -245,7 +238,7 @@ function Write-PesterDebugMessage { [CmdletBinding(DefaultParameterSetName = "Default")] param ( [Parameter(Mandatory = $true, Position = 0)] - [ValidateSet("RuntimeCore", "RuntimeFilter", "RuntimeSkip", "Runtime", "Mock", "MockCore", "Discovery", "DiscoveryCore", "SessionState", "Timing", "TimingCore", "Plugin", "PluginCore")] + [ValidateSet("RuntimeCore", "RuntimeFilter", "RuntimeSkip", "Runtime", "Mock", "MockCore", "Discovery", "DiscoveryCore", "SessionState", "Timing", "TimingCore", "Plugin", "PluginCore", "CodeCoverage")] [String] $Scope, [Parameter(Mandatory = $true, Position = 1, ParameterSetName = "Default")] [String] $Message, @@ -264,9 +257,7 @@ function Write-PesterDebugMessage { return } - - $color = - if ($null -ne $ErrorRecord) { + $color = if ($null -ne $ErrorRecord) { "Red" } else { @@ -283,6 +274,7 @@ function Write-PesterDebugMessage { "TimingCore" { "Gray" } "PluginCore" { "Blue" } "Plugin" { "Blue" } + "CodeCoverage" { "Yellow" } default { "Cyan" } } } @@ -297,9 +289,9 @@ function Write-PesterDebugMessage { $Message = (&$LazyMessage) -join "`n" } - & $_Write_Host -ForegroundColor Black -BackgroundColor $color "${Scope}: $Message " + & $script:SafeCommands['Write-Host'] -ForegroundColor Black -BackgroundColor $color "${Scope}: $Message " if ($null -ne $ErrorRecord) { - & $_Write_Host -ForegroundColor Black -BackgroundColor $color "$ErrorRecord" + & $script:SafeCommands['Write-Host'] -ForegroundColor Black -BackgroundColor $color "$ErrorRecord" } } diff --git a/Pester.psm1 b/src/Pester.ps1 similarity index 87% rename from Pester.psm1 rename to src/Pester.ps1 index 8fcf268bf..885ece8be 100644 --- a/Pester.psm1 +++ b/src/Pester.ps1 @@ -1,23 +1,3 @@ -. $PSScriptRoot/new-runtimepoc/Pester.Types.ps1 -Get-Module Pester.Runtime | Remove-Module -. $PSScriptRoot/new-runtimepoc/Pester.Utility.ps1 -Import-Module $PSScriptRoot/new-runtimepoc/Pester.Runtime.psm1 -DisableNameChecking - - -. $PSScriptRoot/new-runtimepoc/Pester.RSpec.ps1 -. $PSScriptRoot/Functions/Pester.SafeCommands.ps1 -### duplicate from pester.runtime -$flags = [System.Reflection.BindingFlags]'Instance,NonPublic' -$script:SessionStateInternalProperty = [System.Management.Automation.SessionState].GetProperty('Internal', $flags) -$script:ScriptBlockSessionStateInternalProperty = [System.Management.Automation.ScriptBlock].GetProperty('SessionStateInternal', $flags) -$script:ScriptBlockSessionStateProperty = [System.Management.Automation.ScriptBlock].GetProperty("SessionState", $flags) -### - -$script:AssertionOperators = & $SafeCommands['New-Object'] 'Collections.Generic.Dictionary[string,object]'([StringComparer]::InvariantCultureIgnoreCase) -$script:AssertionAliases = & $SafeCommands['New-Object'] 'Collections.Generic.Dictionary[string,object]'([StringComparer]::InvariantCultureIgnoreCase) -$script:AssertionDynamicParams = & $SafeCommands['New-Object'] System.Management.Automation.RuntimeDefinedParameterDictionary -$script:DisableScopeHints = $true - function Assert-ValidAssertionName { param([string]$Name) if ($Name -notmatch '^\S+$') { @@ -258,43 +238,6 @@ function Get-AssertionDynamicParams { return $script:AssertionDynamicParams } -$Script:PesterRoot = & $SafeCommands['Split-Path'] -Path $MyInvocation.MyCommand.Path -"$PesterRoot\Functions\*.ps1", "$PesterRoot\Functions\Assertions\*.ps1" | - & $script:SafeCommands['Resolve-Path'] | - & $script:SafeCommands['Where-Object'] { -not ($_.ProviderPath.ToLower().Contains(".tests.")) } | - & $script:SafeCommands['ForEach-Object'] { . $_.ProviderPath } - -if (& $script:SafeCommands['Test-Path'] "$PesterRoot\Dependencies") { - # sub-modules - & $script:SafeCommands['Get-ChildItem'] "$PesterRoot\Dependencies\*\*.psm1" | - & $script:SafeCommands['ForEach-Object'] { & $script:SafeCommands['Import-Module'] $_.FullName -DisableNameChecking } -} - -Add-Type -TypeDefinition @" -using System; - -namespace Pester -{ - [Flags] - public enum OutputTypes - { - None = 0, - Default = 1, - Passed = 2, - Failed = 4, - Pending = 8, - Skipped = 16, - Inconclusive = 32, - Describe = 64, - Context = 128, - Summary = 256, - Header = 512, - All = Default | Passed | Failed | Pending | Skipped | Inconclusive | Describe | Context | Summary | Header, - Fails = Default | Failed | Pending | Skipped | Inconclusive | Describe | Context | Summary | Header - } -} -"@ - function Has-Flag { param ( @@ -370,14 +313,6 @@ function Invoke-Pester { } Get-Variable 'Configuration' -Scope Local | Remove-Variable - - # Ensure when running Pester that we're using RSpec strings - & $script:SafeCommands['Import-LocalizedData'] -BindingVariable Script:ReportStrings -BaseDirectory $PesterRoot -FileName RSpec.psd1 -ErrorAction SilentlyContinue - - # Fallback to en-US culture strings - if ([String]::IsNullOrEmpty($ReportStrings)) { - & $script:SafeCommands['Import-LocalizedData'] -BaseDirectory $PesterRoot -BindingVariable Script:ReportStrings -UICulture 'en-US' -FileName RSpec.psd1 -ErrorAction Stop - } } end { @@ -518,7 +453,7 @@ function Invoke-Pester { $containers = @() if (any $PesterPreference.Run.ScriptBlock.Value) { - $containers += @( $PesterPreference.Run.ScriptBlock.Value | foreach { Pester.Runtime\New-BlockContainerObject -ScriptBlock $_ }) + $containers += @( $PesterPreference.Run.ScriptBlock.Value | foreach { New-BlockContainerObject -ScriptBlock $_ }) } if ((any $PesterPreference.Run.Path.Value)) { @@ -526,7 +461,7 @@ function Invoke-Pester { #TODO: Skipping the invocation when scriptblock is provided and the default path, later keep path in the default parameter set and remove scriptblock from it, so get-help still shows . as the default value and we can still provide script blocks via an advanced settings parameter # TODO: pass the startup options as context to Start instead of just paths - $containers += @(Find-File -Path $PesterPreference.Run.Path.Value -ExcludePath $PesterPreference.Run.ExcludePath.Value -Extension $PesterPreference.Run.TestExtension.Value | foreach { Pester.Runtime\New-BlockContainerObject -File $_ }) + $containers += @(Find-File -Path $PesterPreference.Run.Path.Value -ExcludePath $PesterPreference.Run.ExcludePath.Value -Extension $PesterPreference.Run.TestExtension.Value | foreach { New-BlockContainerObject -File $_ }) } } @@ -536,6 +471,8 @@ function Invoke-Pester { Containers = $containers Configuration = $pluginConfiguration GlobalPluginData = $pluginData + WriteDebugMessages = $PesterPreference.Debug.WriteDebugMessages.Value + Write_PesterDebugMessage = if ($PesterPreference.Debug.WriteDebugMessages) { $script:SafeCommands['Write-PesterDebugMessage'] } } -ThrowOnFailure if ((none $containers)) { @@ -909,54 +846,3 @@ function ConvertTo-Pester4Result { $legacyResult } } - -Set-SessionStateHint -Hint Pester -SessionState $ExecutionContext.SessionState -# these functions will be shared with the mock bootstrap function, or used in mocked calls so let's capture them just once instead of everytime we use a mock -$script:SafeCommands['ExecutionContext'] = $ExecutionContext -$script:SafeCommands['Get-MockDynamicParameter'] = $ExecutionContext.SessionState.InvokeCommand.GetCommand('Get-MockDynamicParameter', 'function') -$script:SafeCommands['Write-PesterDebugMessage'] = $ExecutionContext.SessionState.InvokeCommand.GetCommand('Write-PesterDebugMessage', 'function') -$script:SafeCommands['Set-DynamicParameterVariable'] = $ExecutionContext.SessionState.InvokeCommand.GetCommand('Set-DynamicParameterVariable', 'function') - - -Set-Alias 'Add-AssertionOperator' 'Add-ShouldOperator' -Set-Alias 'Get-AssertionOperator' 'Get-ShouldOperator' - - -& $script:SafeCommands['Export-ModuleMember'] @( - 'Invoke-Pester' - - # blocks - 'Describe' - 'Context' - 'It' - - # mocking - 'Mock' - 'InModuleScope' - - # setups - 'BeforeAll' - 'BeforeEach' - 'AfterEach' - 'AfterAll' - - # should - 'Should' - 'Add-ShouldOperator' - 'Get-ShouldOperator' - - # export - 'Export-NunitReport' - 'ConvertTo-NUnitReport' - 'ConvertTo-Pester4Result' - - # legacy - 'Assert-VerifiableMock' - 'Assert-MockCalled' - 'Set-ItResult' - 'New-MockObject' - -) -Alias @( - 'Add-AssertionOperator' - 'Get-AssertionOperator' -) diff --git a/Pester.psd1 b/src/Pester.psd1 similarity index 100% rename from Pester.psd1 rename to src/Pester.psd1 diff --git a/src/Pester.psm1 b/src/Pester.psm1 new file mode 100644 index 000000000..af79e878c --- /dev/null +++ b/src/Pester.psm1 @@ -0,0 +1,50 @@ +# Set-SessionStateHint -Hint Pester -SessionState $ExecutionContext.SessionState +# these functions will be shared with the mock bootstrap function, or used in mocked calls so let's capture them just once instead of everytime we use a mock +$script:SafeCommands['ExecutionContext'] = $ExecutionContext +$script:SafeCommands['Get-MockDynamicParameter'] = $ExecutionContext.SessionState.InvokeCommand.GetCommand('Get-MockDynamicParameter', 'function') +$script:SafeCommands['Write-PesterDebugMessage'] = $ExecutionContext.SessionState.InvokeCommand.GetCommand('Write-PesterDebugMessage', 'function') +$script:SafeCommands['Set-DynamicParameterVariable'] = $ExecutionContext.SessionState.InvokeCommand.GetCommand('Set-DynamicParameterVariable', 'function') + + +Set-Alias 'Add-AssertionOperator' 'Add-ShouldOperator' +Set-Alias 'Get-AssertionOperator' 'Get-ShouldOperator' + + +& $script:SafeCommands['Export-ModuleMember'] @( + 'Invoke-Pester' + + # blocks + 'Describe' + 'Context' + 'It' + + # mocking + 'Mock' + 'InModuleScope' + + # setups + 'BeforeAll' + 'BeforeEach' + 'AfterEach' + 'AfterAll' + + # should + 'Should' + 'Add-ShouldOperator' + 'Get-ShouldOperator' + + # export + 'Export-NunitReport' + 'ConvertTo-NUnitReport' + 'ConvertTo-Pester4Result' + + # legacy + 'Assert-VerifiableMock' + 'Assert-MockCalled' + 'Set-ItResult' + 'New-MockObject' + +) -Alias @( + 'Add-AssertionOperator' + 'Get-AssertionOperator' +) diff --git a/Dependencies/TypeClass/TypeClass.psm1 b/src/TypeClass.psm1 similarity index 100% rename from Dependencies/TypeClass/TypeClass.psm1 rename to src/TypeClass.psm1 diff --git a/new-runtimepoc/Configuration.cs b/src/csharp/Configuration.cs similarity index 100% rename from new-runtimepoc/Configuration.cs rename to src/csharp/Configuration.cs diff --git a/new-runtimepoc/ConversionTests.cs b/src/csharp/ConversionTests.cs similarity index 100% rename from new-runtimepoc/ConversionTests.cs rename to src/csharp/ConversionTests.cs diff --git a/new-runtimepoc/Factory.cs b/src/csharp/Factory.cs similarity index 87% rename from new-runtimepoc/Factory.cs rename to src/csharp/Factory.cs index 4721dd8e7..8a0711671 100644 --- a/new-runtimepoc/Factory.cs +++ b/src/csharp/Factory.cs @@ -18,6 +18,10 @@ public static Dictionary CreateDictionary() return new Dictionary(); } + public static RuntimeDefinedParameterDictionary CreateRuntimeDefinedParameterDictionary() { + return new System.Management.Automation.RuntimeDefinedParameterDictionary(); + } + public static ErrorRecord CreateShouldErrorRecord(string message, string file, string line, string lineText, bool terminating) { var exception = new Exception(message); diff --git a/new-runtimepoc/Pester.csproj b/src/csharp/Pester.csproj similarity index 100% rename from new-runtimepoc/Pester.csproj rename to src/csharp/Pester.csproj diff --git a/src/csharp/Pester.sln b/src/csharp/Pester.sln new file mode 100644 index 000000000..1db97ad1a --- /dev/null +++ b/src/csharp/Pester.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29924.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pester", "Pester.csproj", "{A7D2A002-64A1-4EA2-95F0-2455683B1139}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A7D2A002-64A1-4EA2-95F0-2455683B1139}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A7D2A002-64A1-4EA2-95F0-2455683B1139}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A7D2A002-64A1-4EA2-95F0-2455683B1139}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A7D2A002-64A1-4EA2-95F0-2455683B1139}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1403ABF8-54B5-4E8B-88B7-4F71E7FD6680} + EndGlobalSection +EndGlobal diff --git a/new-runtimepoc/Test.cs b/src/csharp/Test.cs similarity index 100% rename from new-runtimepoc/Test.cs rename to src/csharp/Test.cs diff --git a/en-US/about_BeforeEach_AfterEach.help.txt b/src/en-US/about_BeforeEach_AfterEach.help.txt similarity index 100% rename from en-US/about_BeforeEach_AfterEach.help.txt rename to src/en-US/about_BeforeEach_AfterEach.help.txt diff --git a/en-US/about_Mocking.help.txt b/src/en-US/about_Mocking.help.txt similarity index 100% rename from en-US/about_Mocking.help.txt rename to src/en-US/about_Mocking.help.txt diff --git a/en-US/about_Pester.help.txt b/src/en-US/about_Pester.help.txt similarity index 100% rename from en-US/about_Pester.help.txt rename to src/en-US/about_Pester.help.txt diff --git a/en-US/about_Should.help.txt b/src/en-US/about_Should.help.txt similarity index 100% rename from en-US/about_Should.help.txt rename to src/en-US/about_Should.help.txt diff --git a/en-US/about_TestDrive.help.txt b/src/en-US/about_TestDrive.help.txt similarity index 100% rename from en-US/about_TestDrive.help.txt rename to src/en-US/about_TestDrive.help.txt diff --git a/Functions/Context.ps1 b/src/functions/Context.ps1 similarity index 94% rename from Functions/Context.ps1 rename to src/functions/Context.ps1 index 8b9381f0a..3bac04591 100644 --- a/Functions/Context.ps1 +++ b/src/functions/Context.ps1 @@ -79,7 +79,7 @@ about_TestDrive } if ($ExecutionContext.SessionState.PSVariable.Get("invokedViaInvokePester")) { - Pester.Runtime\New-Block -Name $Name -ScriptBlock $Fixture -Tag $Tag -FrameworkData @{ CommandUsed = "Context" } -Focus:$Focus -Skip:$Skip + New-Block -Name $Name -ScriptBlock $Fixture -Tag $Tag -FrameworkData @{ CommandUsed = "Context" } -Focus:$Focus -Skip:$Skip } else { if ($invokedInteractively) { diff --git a/src/functions/Coverage.Plugin.ps1 b/src/functions/Coverage.Plugin.ps1 new file mode 100644 index 000000000..7e1528752 --- /dev/null +++ b/src/functions/Coverage.Plugin.ps1 @@ -0,0 +1,47 @@ +function Get-CoveragePlugin { + New-PluginObject -Name "Coverage" -Start { + param($Context) + + $logger = if ($Context.WriteDebugMessages) { + $sw = [System.Diagnostics.Stopwatch]::StartNew() + # return partially apply callback to the logger when the logging is enabled + # or implicit null + { + param ($Message) + & $Context.Write_PesterDebugMessage -Scope CodeCoverage -Message $Message + } + } + + if ($null -ne $logger) { + & $logger "Starting code coverage." + } + + $config = $Context.Configuration['Coverage'] + + if ($null -ne $logger) { + & $logger "Config: $($config | & $script:SafeCommands['Out-String'])" + } + + $breakpoints = Enter-CoverageAnalysis -CodeCoverage $config -Logger $logger + + $Context.GlobalPluginData.Add('Coverage', @{ + CommandCoverage = $breakpoints + CoverageReport = $null + }) + + if ($null -ne $logger) { + & $logger "Added $($breakpoints.Counts) breakpoints in $($sw.ElapsedMilliseconds) ms." + } + } -End { + param($Context) + + if (-not $Context.TestRun.PluginData.ContainsKey("Coverage")) { + return + } + + $coverageData = $Context.TestRun.PluginData.Coverage + $breakpoints = $coverageData.CommandCoverage + + Exit-CoverageAnalysis -CommandCoverage $breakpoints + } +} diff --git a/Functions/Coverage.ps1 b/src/functions/Coverage.ps1 similarity index 97% rename from Functions/Coverage.ps1 rename to src/functions/Coverage.ps1 index 63af52826..3c8709ad0 100644 --- a/Functions/Coverage.ps1 +++ b/src/functions/Coverage.ps1 @@ -1,18 +1,23 @@ function Enter-CoverageAnalysis { [CmdletBinding()] param ( - [object[]] $CodeCoverage + [object[]] $CodeCoverage, + [ScriptBlock] $Logger ) $coverageInfo = foreach ($object in $CodeCoverage) { - Get-CoverageInfoFromUserInput -InputObject $object + Get-CoverageInfoFromUserInput -InputObject $object -Logger $Logger } if ($null -eq $coverageInfo) { - # no files were found for coverage + if ($null -ne $logger) { + & $logger "No no files were found for coverage." + } + return @() } - @(Get-CoverageBreakpoints -CoverageInfo $coverageInfo) + + @(Get-CoverageBreakpoints -CoverageInfo $coverageInfo -Logger $Logger) } function Exit-CoverageAnalysis { @@ -35,7 +40,8 @@ function Get-CoverageInfoFromUserInput { param ( [Parameter(Mandatory = $true)] [object] - $InputObject + $InputObject, + $Logger ) if ($InputObject -is [System.Collections.IDictionary]) { @@ -142,12 +148,16 @@ function Resolve-CoverageInfo { function Get-CoverageBreakpoints { [CmdletBinding()] param ( - [object[]] $CoverageInfo + [object[]] $CoverageInfo, + [ScriptBlock]$Logger ) $fileGroups = @($CoverageInfo | & $SafeCommands['Group-Object'] -Property Path) foreach ($fileGroup in $fileGroups) { - & $SafeCommands['Write-Verbose'] "Initializing code coverage analysis for file '$($fileGroup.Name)'" + if ($null -ne $Logger) { + $sw = [System.Diagnostics.Stopwatch]::StartNew() + & $Logger "Initializing code coverage analysis for file '$($fileGroup.Name)'" + } $totalCommands = 0 $analyzedCommands = 0 @@ -163,8 +173,9 @@ function Get-CoverageBreakpoints { } } } - - & $SafeCommands['Write-Verbose'] "Analyzing $analyzedCommands of $totalCommands commands in file '$($fileGroup.Name)' for code coverage" + if ($null -ne $Logger) { + & $Logger "Analyzing $analyzedCommands of $totalCommands commands in file '$($fileGroup.Name)' for code coverage, in $($sw.ElapsedMilliseconds) ms" + } } } diff --git a/Functions/Describe.ps1 b/src/functions/Describe.ps1 similarity index 100% rename from Functions/Describe.ps1 rename to src/functions/Describe.ps1 diff --git a/Functions/Environment.ps1 b/src/functions/Environment.ps1 similarity index 100% rename from Functions/Environment.ps1 rename to src/functions/Environment.ps1 diff --git a/Functions/Get-ShouldOperator.ps1 b/src/functions/Get-ShouldOperator.ps1 similarity index 100% rename from Functions/Get-ShouldOperator.ps1 rename to src/functions/Get-ShouldOperator.ps1 diff --git a/Functions/In.ps1 b/src/functions/In.ps1 similarity index 100% rename from Functions/In.ps1 rename to src/functions/In.ps1 diff --git a/Functions/InModuleScope.ps1 b/src/functions/InModuleScope.ps1 similarity index 100% rename from Functions/InModuleScope.ps1 rename to src/functions/InModuleScope.ps1 diff --git a/Functions/It.ps1 b/src/functions/It.ps1 similarity index 100% rename from Functions/It.ps1 rename to src/functions/It.ps1 diff --git a/Functions/Mock.ps1 b/src/functions/Mock.ps1 similarity index 100% rename from Functions/Mock.ps1 rename to src/functions/Mock.ps1 diff --git a/Functions/New-MockObject.ps1 b/src/functions/New-MockObject.ps1 similarity index 100% rename from Functions/New-MockObject.ps1 rename to src/functions/New-MockObject.ps1 diff --git a/Functions/Output.ps1 b/src/functions/Output.ps1 similarity index 93% rename from Functions/Output.ps1 rename to src/functions/Output.ps1 index e5b2759f2..89064bfa3 100644 --- a/Functions/Output.ps1 +++ b/src/functions/Output.ps1 @@ -380,22 +380,13 @@ function ConvertTo-FailureLines { else { # omit the lines internal to Pester if ((GetPesterOS) -ne 'Windows') { - [String]$pattern1 = '^at .*, .*/Pester.Runtime.psm1: line [0-9]*$' - [String]$pattern2 = '^at (Invoke-Test|Context|Describe|InModuleScope), .*/Functions/.*.ps1: line [0-9]*$' - [String]$pattern3 = '^at (Invoke-Pester), .*/.*.psm1: line [0-9]*$' - [String]$pattern4 = '^at (Should|Invoke-Assertion), .*/Functions/Assertions/Should.ps1: line [0-9]*$' - [String]$pattern5 = '^at Assert-MockCalled, .*/Functions/Mock.ps1: line [0-9]*$' - [String]$pattern6 = '^at , (|.*/Functions/.*.ps1): line [0-9]*$' - [String]$pattern7 = '^at Invoke-LegacyAssertion, .*/Functions/.*.ps1: line [0-9]*$' + [String]$isPesterFunction = '^at .*, .*/Pester.psm1: line [0-9]*$' + [String]$isShould = '^at (Should|Invoke-Assertion), .*/Pester.psm1: line [0-9]*$' + # [String]$pattern6 = '^at , (|.*/Pester.psm1): line [0-9]*$' } else { - [String]$pattern1 = '^at .*, .*\\Pester.Runtime.psm1: line [0-9]*$' - [String]$pattern2 = '^at (Invoke-Test|Context|Describe|InModuleScope), .*\\Functions\\.*.ps1: line [0-9]*$' - [String]$pattern3 = '^at (Invoke-Pester), .*\\.*.psm1: line [0-9]*$' - [String]$pattern4 = '^at (Should|Invoke-Assertion), .*\\Functions\\Assertions\\Should.ps1: line [0-9]*$' - [String]$pattern5 = '^at Assert-MockCalled, .*\\Functions\\Mock.ps1: line [0-9]*$' - [String]$pattern6 = '^at , (|.*\\Functions\\.*.ps1): line [0-9]*$' - [String]$pattern7 = '^at Invoke-LegacyAssertion, .*\\Functions\\.*.ps1: line [0-9]*$' + [String]$isPesterFunction = '^at .*, .*\\Pester.psm1: line [0-9]*$' + [String]$isShould = '^at (Should|Invoke-Assertion), .*\\Pester.psm1: line [0-9]*$' } # reducing the stack trace so we see only stack trace until the current It block and not up until the invocation of the @@ -405,16 +396,11 @@ function ConvertTo-FailureLines { # we want to be able to see that we invoked the assertion inside of function a # the internal calls to Should and Invoke-Assertion are filtered out later by the second match foreach ($line in $traceLines) { - if ($line -match $pattern1) { + if ($line -match $isPesterFunction -and $line -notmatch $isShould) { break } - $isPesterInternalFunction = $line -match $pattern2 -or - $line -match $pattern3 -or - $line -match $pattern4 -or - $line -match $pattern5 -or - $line -match $pattern6 -or - $line -match $pattern7 + $isPesterInternalFunction = $line -match $isPesterFunction if (-not $isPesterInternalFunction) { $lines.Trace += $line @@ -441,7 +427,7 @@ function ConvertTo-HumanTime { function Get-WriteScreenPlugin { # add -FrameworkSetup Write-PesterStart $pester $Script and -FrameworkTeardown { $pester | Write-PesterReport } # The plugin is not imported when output None is specified so the usual level of output is Minimal. - Pester.Runtime\New-PluginObject -Name "WriteScreen" ` + New-PluginObject -Name "WriteScreen" ` -Start { param ($Context) diff --git a/Functions/Pester.Debugging.ps1 b/src/functions/Pester.Debugging.ps1 similarity index 100% rename from Functions/Pester.Debugging.ps1 rename to src/functions/Pester.Debugging.ps1 diff --git a/src/functions/Pester.SafeCommands.ps1 b/src/functions/Pester.SafeCommands.ps1 new file mode 100644 index 000000000..028867d0e --- /dev/null +++ b/src/functions/Pester.SafeCommands.ps1 @@ -0,0 +1,107 @@ +$script:IgnoreErrorPreference = 'Ignore' # TODO: get rid of this, it is used in only few places + +# Tried using $ExecutionState.InvokeCommand.GetCmdlet() here, but it does not trigger module auto-loading the way +# Get-Command does. Since this is at import time, before any mocks have been defined, that's probably acceptable. +# If someone monkeys with Get-Command before they import Pester, they may break something. + +# The -All parameter is required when calling Get-Command to ensure that PowerShell can find the command it is +# looking for. Otherwise, if you have modules loaded that define proxy cmdlets or that have cmdlets with the same +# name as the safe cmdlets, Get-Command will return null. +$safeCommandLookupParameters = @{ + CommandType = 'Cmdlet' + ErrorAction = 'Stop' + All = $true +} + +$Get_Command = Get-Command Get-Command -CommandType Cmdlet -ErrorAction 'Stop' +$script:SafeCommands = @{ + 'Get-Command' = $Get_Command + 'Add-Member' = & $Get_Command -Name Add-Member -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Add-Type' = & $Get_Command -Name Add-Type -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Compare-Object' = & $Get_Command -Name Compare-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Export-ModuleMember' = & $Get_Command -Name Export-ModuleMember -Module Microsoft.PowerShell.Core @safeCommandLookupParameters + 'ForEach-Object' = & $Get_Command -Name ForEach-Object -Module Microsoft.PowerShell.Core @safeCommandLookupParameters + 'Format-Table' = & $Get_Command -Name Format-Table -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Get-Alias' = & $Get_Command -Name Get-Alias -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Get-ChildItem' = & $Get_Command -Name Get-ChildItem -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'Get-Content' = & $Get_Command -Name Get-Content -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'Get-Date' = & $Get_Command -Name Get-Date -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Get-Item' = & $Get_Command -Name Get-Item -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'Get-ItemProperty' = & $Get_Command -Name Get-ItemProperty -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'Get-Location' = & $Get_Command -Name Get-Location -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'Get-Member' = & $Get_Command -Name Get-Member -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Get-Module' = & $Get_Command -Name Get-Module -Module Microsoft.PowerShell.Core @safeCommandLookupParameters + 'Get-PSDrive' = & $Get_Command -Name Get-PSDrive -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'Get-PSCallStack' = & $Get_Command -Name Get-PSCallStack -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Get-Unique' = & $Get_Command -Name Get-Unique -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Get-Variable' = & $Get_Command -Name Get-Variable -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Group-Object' = & $Get_Command -Name Group-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Import-LocalizedData' = & $Get_Command -Name Import-LocalizedData -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Import-Module' = & $Get_Command -Name Import-Module -Module Microsoft.PowerShell.Core @safeCommandLookupParameters + 'Join-Path' = & $Get_Command -Name Join-Path -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'Measure-Object' = & $Get_Command -Name Measure-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'New-Item' = & $Get_Command -Name New-Item -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'New-ItemProperty' = & $Get_Command -Name New-ItemProperty -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'New-Module' = & $Get_Command -Name New-Module -Module Microsoft.PowerShell.Core @safeCommandLookupParameters + 'New-Object' = & $Get_Command -Name New-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'New-PSDrive' = & $Get_Command -Name New-PSDrive -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'New-Variable' = & $Get_Command -Name New-Variable -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Out-Host' = & $Get_Command -Name Out-Host -Module Microsoft.PowerShell.Core @safeCommandLookupParameters + 'Out-File' = & $Get_Command -Name Out-File -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Out-Null' = & $Get_Command -Name Out-Null -Module Microsoft.PowerShell.Core @safeCommandLookupParameters + 'Out-String' = & $Get_Command -Name Out-String -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Pop-Location' = & $Get_Command -Name Pop-Location -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'Push-Location' = & $Get_Command -Name Push-Location -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'Remove-Item' = & $Get_Command -Name Remove-Item -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'Remove-PSBreakpoint' = & $Get_Command -Name Remove-PSBreakpoint -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Remove-PSDrive' = & $Get_Command -Name Remove-PSDrive -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'Remove-Variable' = & $Get_Command -Name Remove-Variable -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Resolve-Path' = & $Get_Command -Name Resolve-Path -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'Select-Object' = & $Get_Command -Name Select-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Set-Alias' = & $Get_Command -Name Set-Alias -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Set-Content' = & $Get_Command -Name Set-Content -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'Set-Location' = & $Get_Command -Name Set-Location -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'Set-PSBreakpoint' = & $Get_Command -Name Set-PSBreakpoint -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Set-StrictMode' = & $Get_Command -Name Set-StrictMode -Module Microsoft.PowerShell.Core @safeCommandLookupParameters + 'Set-Variable' = & $Get_Command -Name Set-Variable -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Sort-Object' = & $Get_Command -Name Sort-Object -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Split-Path' = & $Get_Command -Name Split-Path -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'Start-Sleep' = & $Get_Command -Name Start-Sleep -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Test-Path' = & $Get_Command -Name Test-Path -Module Microsoft.PowerShell.Management @safeCommandLookupParameters + 'Where-Object' = & $Get_Command -Name Where-Object -Module Microsoft.PowerShell.Core @safeCommandLookupParameters + 'Write-Error' = & $Get_Command -Name Write-Error -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Write-Host' = & $Get_Command -Name Write-Host -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Write-Progress' = & $Get_Command -Name Write-Progress -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Write-Verbose' = & $Get_Command -Name Write-Verbose -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters + 'Write-Warning' = & $Get_Command -Name Write-Warning -Module Microsoft.PowerShell.Utility @safeCommandLookupParameters +} + +# Not all platforms have Get-WmiObject (Nano or PSCore 6.0.0-beta.x on Linux) +# Get-CimInstance is preferred, but we can use Get-WmiObject if it exists +# Moreover, it shouldn't really be fatal if neither of those cmdlets +# exist +if (($cim = & $Get_Command -Name Get-CimInstance -Module CimCmdlets -CommandType Cmdlet -ErrorAction Ignore)) { + $script:SafeCommands['Get-CimInstance'] = $cim +} +elseif (($wmi = & $Get_Command -Name Get-WmiObject -Module Microsoft.PowerShell.Management -CommandType Cmdlet -ErrorAction Ignore)) { + $script:SafeCommands['Get-WmiObject'] = $wmi +} +elseif (($unames = & $Get_Command -Name uname -CommandType Application -ErrorAction Ignore)) { + $script:SafeCommands['uname'] = if ($null -ne $unames -and 0 -lt @($unames).Count) { $unames[0] } + if (($ids = & $Get_Command -Name id -CommandType Application -ErrorAction Ignore)) { + $script:SafeCommands['id'] = if ($null -ne $ids -and 0 -lt @($ids).Count) { $ids[0] } + } +} +else { + Write-Warning "OS Information retrieval is not possible, reports will contain only partial system data" +} + +# little sanity check to make sure we don't blow up a system with a typo up there +# (not that I've EVER done that by, for example, mapping New-Item to Remove-Item...) + +foreach ($keyValuePair in $script:SafeCommands.GetEnumerator()) { + if ($keyValuePair.Key -ne $keyValuePair.Value.Name) { + throw "SafeCommands entry for $($keyValuePair.Key) does not hold a reference to the proper command." + } +} + diff --git a/Functions/Pester.Scoping.ps1 b/src/functions/Pester.Scoping.ps1 similarity index 100% rename from Functions/Pester.Scoping.ps1 rename to src/functions/Pester.Scoping.ps1 diff --git a/Functions/Pester.SessionState.Mock.ps1 b/src/functions/Pester.SessionState.Mock.ps1 similarity index 99% rename from Functions/Pester.SessionState.Mock.ps1 rename to src/functions/Pester.SessionState.Mock.ps1 index 2076a4c05..066258d75 100644 --- a/Functions/Pester.SessionState.Mock.ps1 +++ b/src/functions/Pester.SessionState.Mock.ps1 @@ -4,7 +4,7 @@ # the whole documentation :D ) function Get-MockPlugin () { - Pester.Runtime\New-PluginObject -Name "Mock" ` + New-PluginObject -Name "Mock" ` -EachBlockSetupStart { param($Context) $Context.Block.PluginData.Mock = @{ diff --git a/Functions/PesterState.ps1 b/src/functions/PesterState.ps1 similarity index 100% rename from Functions/PesterState.ps1 rename to src/functions/PesterState.ps1 diff --git a/Functions/Set-ItResult.ps1 b/src/functions/Set-ItResult.ps1 similarity index 100% rename from Functions/Set-ItResult.ps1 rename to src/functions/Set-ItResult.ps1 diff --git a/Functions/SetupTeardown.ps1 b/src/functions/SetupTeardown.ps1 similarity index 92% rename from Functions/SetupTeardown.ps1 rename to src/functions/SetupTeardown.ps1 index fb475a075..03d1cc4b6 100644 --- a/Functions/SetupTeardown.ps1 +++ b/src/functions/SetupTeardown.ps1 @@ -28,7 +28,7 @@ function BeforeEach { ) Assert-DescribeInProgress -CommandName BeforeEach - Pester.Runtime\New-EachTestSetup -ScriptBlock $Scriptblock + New-EachTestSetup -ScriptBlock $Scriptblock } function AfterEach { @@ -61,7 +61,7 @@ function AfterEach { ) Assert-DescribeInProgress -CommandName AfterEach - Pester.Runtime\New-EachTestTeardown -ScriptBlock $Scriptblock + New-EachTestTeardown -ScriptBlock $Scriptblock } function BeforeAll { @@ -91,7 +91,7 @@ function BeforeAll { $Scriptblock ) - Pester.Runtime\New-OneTimeTestSetup -ScriptBlock $Scriptblock + New-OneTimeTestSetup -ScriptBlock $Scriptblock } function AfterAll { @@ -122,5 +122,5 @@ function AfterAll { ) Assert-DescribeInProgress -CommandName AfterAll - Pester.Runtime\New-OneTimeTestTeardown -ScriptBlock $Scriptblock + New-OneTimeTestTeardown -ScriptBlock $Scriptblock } diff --git a/Functions/TestDrive.ps1 b/src/functions/TestDrive.ps1 similarity index 98% rename from Functions/TestDrive.ps1 rename to src/functions/TestDrive.ps1 index ebaa3b7ad..6cfa2975b 100644 --- a/Functions/TestDrive.ps1 +++ b/src/functions/TestDrive.ps1 @@ -6,7 +6,7 @@ function Get-TestDrivePlugin { Remove-Item (Get-PSDrive TestDrive -ErrorAction Stop).Root -Force -Recurse -Confirm:$false Remove-PSDrive TestDrive } - Pester.Runtime\New-PluginObject -Name "TestDrive" -EachBlockSetupStart { + New-PluginObject -Name "TestDrive" -EachBlockSetupStart { param($Context) if (-not ($Context.Block.PluginData.ContainsKey('TestDrive'))) { $Context.Block.PluginData.Add('TestDrive', @{ diff --git a/Functions/TestRegistry.ps1 b/src/functions/TestRegistry.ps1 similarity index 100% rename from Functions/TestRegistry.ps1 rename to src/functions/TestRegistry.ps1 diff --git a/Functions/TestResults.ps1 b/src/functions/TestResults.ps1 similarity index 100% rename from Functions/TestResults.ps1 rename to src/functions/TestResults.ps1 diff --git a/Functions/Assertions/Be.ps1 b/src/functions/assertions/Be.ps1 similarity index 98% rename from Functions/Assertions/Be.ps1 rename to src/functions/assertions/Be.ps1 index 9aeeebcfd..fa5a714c6 100644 --- a/Functions/Assertions/Be.ps1 +++ b/src/functions/assertions/Be.ps1 @@ -51,7 +51,7 @@ function ShouldBeFailureMessage($ActualValue, $ExpectedValue, $Because) { } <#joining the output strings to a single string here, otherwise I get Cannot find an overload for "Exception" and the argument count: "4". - at line: 63 in C:\Users\nohwnd\github\pester\Functions\Assertions\Should.ps1 + at line: 63 in C:\Users\nohwnd\github\pester\functions\Assertions\Should.ps1 This is a quickwin solution, doing the join in the Should directly might be better way of doing this. But I don't want to mix two problems. @@ -121,7 +121,7 @@ function ShouldBeExactlyFailureMessage($ActualValue, $ExpectedValue, $Because) { } <#joining the output strings to a single string here, otherwise I get Cannot find an overload for "Exception" and the argument count: "4". - at line: 63 in C:\Users\nohwnd\github\pester\Functions\Assertions\Should.ps1 + at line: 63 in C:\Users\nohwnd\github\pester\functions\Assertions\Should.ps1 This is a quickwin solution, doing the join in the Should directly might be better way of doing this. But I don't want to mix two problems. diff --git a/Functions/Assertions/BeGreaterThan.ps1 b/src/functions/assertions/BeGreaterThan.ps1 similarity index 100% rename from Functions/Assertions/BeGreaterThan.ps1 rename to src/functions/assertions/BeGreaterThan.ps1 diff --git a/Functions/Assertions/BeIn.ps1 b/src/functions/assertions/BeIn.ps1 similarity index 100% rename from Functions/Assertions/BeIn.ps1 rename to src/functions/assertions/BeIn.ps1 diff --git a/Functions/Assertions/BeLessThan.ps1 b/src/functions/assertions/BeLessThan.ps1 similarity index 100% rename from Functions/Assertions/BeLessThan.ps1 rename to src/functions/assertions/BeLessThan.ps1 diff --git a/Functions/Assertions/BeLike.ps1 b/src/functions/assertions/BeLike.ps1 similarity index 100% rename from Functions/Assertions/BeLike.ps1 rename to src/functions/assertions/BeLike.ps1 diff --git a/Functions/Assertions/BeLikeExactly.ps1 b/src/functions/assertions/BeLikeExactly.ps1 similarity index 100% rename from Functions/Assertions/BeLikeExactly.ps1 rename to src/functions/assertions/BeLikeExactly.ps1 diff --git a/Functions/Assertions/BeNullOrEmpty.ps1 b/src/functions/assertions/BeNullOrEmpty.ps1 similarity index 100% rename from Functions/Assertions/BeNullOrEmpty.ps1 rename to src/functions/assertions/BeNullOrEmpty.ps1 diff --git a/Functions/Assertions/BeOfType.ps1 b/src/functions/assertions/BeOfType.ps1 similarity index 100% rename from Functions/Assertions/BeOfType.ps1 rename to src/functions/assertions/BeOfType.ps1 diff --git a/Functions/Assertions/BeTrueOrFalse.ps1 b/src/functions/assertions/BeTrueOrFalse.ps1 similarity index 100% rename from Functions/Assertions/BeTrueOrFalse.ps1 rename to src/functions/assertions/BeTrueOrFalse.ps1 diff --git a/Functions/Assertions/Contain.ps1 b/src/functions/assertions/Contain.ps1 similarity index 100% rename from Functions/Assertions/Contain.ps1 rename to src/functions/assertions/Contain.ps1 diff --git a/Functions/Assertions/Exist.ps1 b/src/functions/assertions/Exist.ps1 similarity index 100% rename from Functions/Assertions/Exist.ps1 rename to src/functions/assertions/Exist.ps1 diff --git a/Functions/Assertions/FileContentMatch.ps1 b/src/functions/assertions/FileContentMatch.ps1 similarity index 100% rename from Functions/Assertions/FileContentMatch.ps1 rename to src/functions/assertions/FileContentMatch.ps1 diff --git a/Functions/Assertions/FileContentMatchExactly.ps1 b/src/functions/assertions/FileContentMatchExactly.ps1 similarity index 100% rename from Functions/Assertions/FileContentMatchExactly.ps1 rename to src/functions/assertions/FileContentMatchExactly.ps1 diff --git a/Functions/Assertions/FileContentMatchMultiline.ps1 b/src/functions/assertions/FileContentMatchMultiline.ps1 similarity index 100% rename from Functions/Assertions/FileContentMatchMultiline.ps1 rename to src/functions/assertions/FileContentMatchMultiline.ps1 diff --git a/Functions/Assertions/HaveCount.ps1 b/src/functions/assertions/HaveCount.ps1 similarity index 100% rename from Functions/Assertions/HaveCount.ps1 rename to src/functions/assertions/HaveCount.ps1 diff --git a/Functions/Assertions/HaveParameter.ps1 b/src/functions/assertions/HaveParameter.ps1 similarity index 100% rename from Functions/Assertions/HaveParameter.ps1 rename to src/functions/assertions/HaveParameter.ps1 diff --git a/Functions/Assertions/Match.ps1 b/src/functions/assertions/Match.ps1 similarity index 100% rename from Functions/Assertions/Match.ps1 rename to src/functions/assertions/Match.ps1 diff --git a/Functions/Assertions/MatchExactly.ps1 b/src/functions/assertions/MatchExactly.ps1 similarity index 100% rename from Functions/Assertions/MatchExactly.ps1 rename to src/functions/assertions/MatchExactly.ps1 diff --git a/Functions/Assertions/PesterThrow.ps1 b/src/functions/assertions/PesterThrow.ps1 similarity index 100% rename from Functions/Assertions/PesterThrow.ps1 rename to src/functions/assertions/PesterThrow.ps1 diff --git a/Functions/Assertions/Should.ps1 b/src/functions/assertions/Should.ps1 similarity index 100% rename from Functions/Assertions/Should.ps1 rename to src/functions/assertions/Should.ps1 diff --git a/nunit_schema_2.5.xsd b/src/nunit_schema_2.5.xsd similarity index 100% rename from nunit_schema_2.5.xsd rename to src/nunit_schema_2.5.xsd diff --git a/report.dtd b/src/report.dtd similarity index 100% rename from report.dtd rename to src/report.dtd diff --git a/test.ps1 b/test.ps1 index 7c8884bce..2e5799817 100644 --- a/test.ps1 +++ b/test.ps1 @@ -1,7 +1,8 @@ param ( # force P to fail when I leave `dt` in the tests [switch]$CI, - [switch]$SkipPTests + [switch]$SkipPTests, + [switch]$NoBuild ) Set-StrictMode -Version Latest @@ -9,10 +10,16 @@ $ErrorActionPreference = 'Stop' # assigning error view explicitly to change it from the default on powershell 7 (travis ci macOS right now) $ErrorView = "NormalView" "Using PS $($PsVersionTable.PSVersion)" + +if (-not $NoBuild) { + & "$PSScriptRoot/build.ps1" +} + +# remove pester because we will be reimporting it in multiple other places Get-Module Pester | Remove-Module if (-not $SkipPTests) { - $result = @(Get-ChildItem *.ts.ps1 -Recurse | + $result = @(Get-ChildItem $PSScriptRoot/tst/*.ts.ps1 -Recurse | foreach { $r = & $_.FullName -PassThru if ($r.Failed -gt 0) { @@ -42,19 +49,55 @@ if (-not $SkipPTests) { } } -$global:PesterPreference = @{ - Debug = @{ - ShowFullErrors = $false - ShowNavigationMarkers = $true +# reset pester and all preferences +$PesterPreference = [PesterConfiguration]::Default +Get-Module Pester | Remove-Module + +Import-Module $PSScriptRoot/bin/Pester.psd1 -ErrorAction Stop + +# add our own in module scope because the implementation +# pester relies on being in different sesstion state than +# the module scope target +Get-Module TestHelpers | Remove-Module +New-Module -Name TestHelpers -ScriptBlock { + function InPesterModuleScope { + [CmdletBinding()] + param ( + [Parameter(Mandatory = $true)] + [scriptblock] + $ScriptBlock + ) + + $module = Get-Module -Name Pester -ErrorAction Stop + . $module $ScriptBlock } +} | Out-Null + + +$configuration = [PesterConfiguration]::Default + +$configuration.Debug.WriteDebugMessages = $false +# $configuration.Debug.WriteDebugMessagesFrom = 'CodeCoverage' + +$configuration.Debug.ShowFullErrors = $true +$configuration.Debug.ShowNavigationMarkers = $true + +$configuration.Run.Path = "$PSScriptRoot/tst" +$configuration.Run.ExcludePath = '*/demo/*', '*/examples/*', '*/testProjects/*' +$configuration.Run.PassThru = $true + +$configuration.Filter.ExcludeTag = 'VersionChecks', 'StyleRules', 'Help' + +$configuration.Output.Verbosity = 'Minimal' + +if ($CI) { + $configuration.Run.Exit = $true + + # skipping cc and tr because I don't need them right now and cc is extremely slow + # $configuration.CodeCoverage.Enabled = $true + # $configuration.CodeCoverage.Path = "$PSScriptRoot/src/*" + + # $configuration.TestResult.Enabled = $true } -Get-Module Pester | Remove-Module -Import-Module ./Pester.psd1 -$r = Invoke-Pester ` - -Path . ` - -CI:$CI ` - -Output Minimal ` - -ExcludeTag VersionChecks, StyleRules, Help ` - -ExcludePath '*/demo/*', '*/examples/*', '*/TestProjects/*' ` - -PassThru +$r = Invoke-Pester -Configuration $configuration diff --git a/Dependencies/Format/Format.Tests.ps1 b/tst/Format.Tests.ps1 similarity index 87% rename from Dependencies/Format/Format.Tests.ps1 rename to tst/Format.Tests.ps1 index 63b92b233..0a6be9cc3 100644 --- a/Dependencies/Format/Format.Tests.ps1 +++ b/tst/Format.Tests.ps1 @@ -1,23 +1,21 @@ Set-StrictMode -Version Latest -$here = $MyInvocation.MyCommand.Path | Split-Path -Get-Module Axiom, Format | Remove-Module -Import-Module $here\..\Axiom\Axiom.psm1 -ErrorAction 'stop' -DisableNameChecking -Import-Module $here\Format.psm1 -ErrorAction 'stop' -DisableNameChecking - -function New-PSObject ([hashtable]$Property) { - New-Object -Type PSObject -Property $Property +BeforeAll { + Get-Module Axiom, Format | Remove-Module + Import-Module $PSScriptRoot\axiom\Axiom.psm1 -ErrorAction 'stop' -DisableNameChecking + Import-Module $PSScriptRoot\..\src\Format.psm1 -ErrorAction 'stop' -DisableNameChecking } -function New-Dictionary ([hashtable]$Hashtable) { - $d = new-object "Collections.Generic.Dictionary[string,object]" +# discovery time setup +# Add-Type -TypeDefinition 'namespace Assertions.TestType { public class Person { public string Name {get;set;} public int Age {get;set;}}}' +# function New-Dictionary ([hashtable]$Hashtable) { +# $d = new-object "Collections.Generic.Dictionary[string,object]" - $Hashtable.GetEnumerator() | foreach { $d.Add($_.Key, $_.Value) } +# $Hashtable.GetEnumerator() | foreach { $d.Add($_.Key, $_.Value) } - $d -} +# $d +# } -# Add-Type -TypeDefinition 'namespace Assertions.TestType { public class Person { public string Name {get;set;} public int Age {get;set;}}}' Describe "Format-Collection" { It "Formats collection of values '' to '' using comma separator" -TestCases @( @{ Value = (1, 2, 3); Expected = "@(1, 2, 3)" } @@ -43,7 +41,7 @@ Describe "Format-Number" { # skipping object formatting for now # Describe "Format-Object" { # It "Formats object '' to ''" -TestCases @( -# @{ Value = (New-PSObject @{Name = 'Jakub'; Age = 28}); Expected = "PSObject{Age=28; Name=Jakub}"}, +# @{ Value = ([PSCustomObject] @{Name = 'Jakub'; Age = 28}); Expected = "PSObject{Age=28; Name=Jakub}"}, # @{ Value = (New-Object -Type Assertions.TestType.Person -Property @{Name = 'Jakub'; Age = 28}); Expected = "Assertions.TestType.Person{Age=28; Name=Jakub}"} # ) { # param ($Value, $Expected) @@ -51,7 +49,7 @@ Describe "Format-Number" { # } # It "Formats object '' with selected properties '' to ''" -TestCases @( -# @{ Value = (New-PSObject @{Name = 'Jakub'; Age = 28}); SelectedProperties = "Age"; Expected = "PSObject{Age=28}"}, +# @{ Value = ([PSCustomObject] @{Name = 'Jakub'; Age = 28}); SelectedProperties = "Age"; Expected = "PSObject{Age=28}"}, # @{ Value = (Get-Process -Name Idle); SelectedProperties = 'Name', 'Id'; Expected = "Diagnostics.Process{Id=0; Name=Idle}" }, # @{ # Value = (New-Object -Type Assertions.TestType.Person -Property @{Name = 'Jakub'; Age = 28}) @@ -146,7 +144,7 @@ Describe "Format-Nicely" { @{ Value = (1, 2, 3); Expected = '@(1, 2, 3)' }, @{ Value = 1.1; Expected = '1.1' }, @{ Value = [int]; Expected = '[int]'} - # @{ Value = New-PSObject @{ Name = "Jakub" }; Expected = 'PSObject{Name=Jakub}' }, + # @{ Value = [PSCustomObject] @{ Name = "Jakub" }; Expected = 'PSObject{Name=Jakub}' }, #@{ Value = (Get-Process Idle); Expected = 'Diagnostics.Process{Id=0; Name=Idle}'}, #@{ Value = (New-Object -Type Assertions.TestType.Person -Property @{Name = 'Jakub'; Age = 28}); Expected = "Assertions.TestType.Person{Age=28; Name=Jakub}"} #@{ Value = @{Name = 'Jakub'; Age = 28}; Expected = '@{Age=28; Name=Jakub}' } @@ -187,7 +185,7 @@ Describe "Get-ShortType" { @{ Value = 1.1; Expected = 'double' }, @{ Value = 'a' ; Expected = 'string' }, @{ Value = $null ; Expected = '' }, - @{ Value = New-PSObject @{Name = 'Jakub'} ; Expected = 'PSObject'}, + @{ Value = [PSCustomObject] @{Name = 'Jakub'} ; Expected = 'PSObject'}, @{ Value = [Object[]]1, 2, 3 ; Expected = 'collection' } ) { param($Value, $Expected) diff --git a/new-runtimepoc/Pester.Mock.RSpec.ts.ps1 b/tst/Pester.Mock.RSpec.ts.ps1 similarity index 98% rename from new-runtimepoc/Pester.Mock.RSpec.ts.ps1 rename to tst/Pester.Mock.RSpec.ts.ps1 index bf536fd05..d6ce7ee78 100644 --- a/new-runtimepoc/Pester.Mock.RSpec.ts.ps1 +++ b/tst/Pester.Mock.RSpec.ts.ps1 @@ -3,9 +3,9 @@ param ([switch] $PassThru) Get-Module Pester.Runtime, Pester.Utility, P, Pester, Axiom, Stack | Remove-Module Import-Module $PSScriptRoot\p.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Dependencies\Axiom\Axiom.psm1 -DisableNameChecking +Import-Module $PSScriptRoot\axiom\Axiom.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Pester.psd1 +Import-Module $PSScriptRoot\..\bin\Pester.psd1 $global:PesterPreference = [PesterConfiguration] @{ Debug = @{ diff --git a/new-runtimepoc/Pester.RSpec.Configuration.ts.ps1 b/tst/Pester.RSpec.Configuration.ts.ps1 similarity index 95% rename from new-runtimepoc/Pester.RSpec.Configuration.ts.ps1 rename to tst/Pester.RSpec.Configuration.ts.ps1 index fea602774..9314ee378 100644 --- a/new-runtimepoc/Pester.RSpec.Configuration.ts.ps1 +++ b/tst/Pester.RSpec.Configuration.ts.ps1 @@ -3,9 +3,9 @@ param ([switch] $PassThru) Get-Module Pester.Runtime, Pester.Utility, P, Pester, Axiom, Stack | Remove-Module Import-Module $PSScriptRoot\p.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Dependencies\Axiom\Axiom.psm1 -DisableNameChecking +Import-Module $PSScriptRoot\axiom\Axiom.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Pester.psd1 +Import-Module $PSScriptRoot\..\bin\Pester.psd1 $global:PesterPreference = @{ Debug = @{ @@ -249,8 +249,8 @@ i -PassThru:$PassThru { b "Advanced interface - Run paths" { t "Running from multiple paths" { - $container1 = "$PSScriptRoot/TestProjects/BasicTests/folder1" - $container2 = "$PSScriptRoot/TestProjects/BasicTests/folder2" + $container1 = "$PSScriptRoot/testProjects/BasicTests/folder1" + $container2 = "$PSScriptRoot/testProjects/BasicTests/folder2" $c = [PesterConfiguration]@{ Run = @{ @@ -270,7 +270,7 @@ i -PassThru:$PassThru { t "Filtering based on tags" { $c = [PesterConfiguration]@{ Run = @{ - Path = "$PSScriptRoot/TestProjects/BasicTests" + Path = "$PSScriptRoot/testProjects/BasicTests" PassThru = $true } Filter = @{ @@ -295,11 +295,11 @@ i -PassThru:$PassThru { t "Filtering test based on line" { $c = [PesterConfiguration]@{ Run = @{ - Path = "$PSScriptRoot/TestProjects/BasicTests" + Path = "$PSScriptRoot/testProjects/BasicTests" PassThru = $true } Filter = @{ - Line = "$PSScriptRoot/TestProjects/BasicTests/folder1/file1.Tests.ps1:6" + Line = "$PSScriptRoot/testProjects/BasicTests/folder1/file1.Tests.ps1:8" } Output = @{ Verbosity = 'None' @@ -316,11 +316,11 @@ i -PassThru:$PassThru { t "Filtering test based on line" { $c = [PesterConfiguration]@{ Run = @{ - Path = "$PSScriptRoot/TestProjects/BasicTests" + Path = "$PSScriptRoot/testProjects/BasicTests" PassThru = $true } Filter = @{ - Line = "$PSScriptRoot/TestProjects/BasicTests/folder1/file1.Tests.ps1:1" + Line = "$PSScriptRoot/testProjects/BasicTests/folder1/file1.Tests.ps1:3" } Output = @{ Verbosity = 'None' @@ -338,7 +338,7 @@ i -PassThru:$PassThru { t "Filtering test based on name will find the test" { $c = [PesterConfiguration]@{ Run = @{ - Path = "$PSScriptRoot/TestProjects/BasicTests" + Path = "$PSScriptRoot/testProjects/BasicTests" PassThru = $true } Filter = @{ diff --git a/new-runtimepoc/Pester.RSpec.Demo.ts.ps1 b/tst/Pester.RSpec.Demo.ts.ps1 similarity index 98% rename from new-runtimepoc/Pester.RSpec.Demo.ts.ps1 rename to tst/Pester.RSpec.Demo.ts.ps1 index 25bf72b51..cd8e3efcc 100644 --- a/new-runtimepoc/Pester.RSpec.Demo.ts.ps1 +++ b/tst/Pester.RSpec.Demo.ts.ps1 @@ -3,9 +3,9 @@ param ([switch] $PassThru) Get-Module Pester.Runtime, Pester.Utility, P, Pester, Axiom, Stack | Remove-Module Import-Module $PSScriptRoot\p.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Dependencies\Axiom\Axiom.psm1 -DisableNameChecking +Import-Module $PSScriptRoot\axiom\Axiom.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Pester.psd1 +Import-Module $PSScriptRoot\..\bin\Pester.psd1 $global:PesterPreference = [PesterConfiguration]@{ Output = @{ Verbosity = 'Normal' } diff --git a/new-runtimepoc/Pester.RSpec.Nunit.TestResults.ts.ps1 b/tst/Pester.RSpec.Nunit.TestResults.ts.ps1 similarity index 99% rename from new-runtimepoc/Pester.RSpec.Nunit.TestResults.ts.ps1 rename to tst/Pester.RSpec.Nunit.TestResults.ts.ps1 index bd92336e6..1cda68977 100644 --- a/new-runtimepoc/Pester.RSpec.Nunit.TestResults.ts.ps1 +++ b/tst/Pester.RSpec.Nunit.TestResults.ts.ps1 @@ -3,9 +3,9 @@ param ([switch] $PassThru) Get-Module Pester.Runtime, Pester.Utility, P, Pester, Axiom, Stack | Remove-Module Import-Module $PSScriptRoot\p.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Dependencies\Axiom\Axiom.psm1 -DisableNameChecking +Import-Module $PSScriptRoot\axiom\Axiom.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Pester.psd1 +Import-Module $PSScriptRoot\..\bin\Pester.psd1 $global:PesterPreference = @{ Debug = @{ diff --git a/new-runtimepoc/Pester.RSpec.Pester4ResultObject.ts.ps1 b/tst/Pester.RSpec.Pester4ResultObject.ts.ps1 similarity index 97% rename from new-runtimepoc/Pester.RSpec.Pester4ResultObject.ts.ps1 rename to tst/Pester.RSpec.Pester4ResultObject.ts.ps1 index caa79d280..000710880 100644 --- a/new-runtimepoc/Pester.RSpec.Pester4ResultObject.ts.ps1 +++ b/tst/Pester.RSpec.Pester4ResultObject.ts.ps1 @@ -5,8 +5,8 @@ return (i -PassThru:$PassThru { }) Get-Module Pester.Runtime, Pester.Utility, P, Pester, Axiom, Stack | Remove-Module Import-Module $PSScriptRoot\p.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Dependencies\Axiom\Axiom.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Pester.psd1 +Import-Module $PSScriptRoot\axiom\Axiom.psm1 -DisableNameChecking +Import-Module $PSScriptRoot\..\bin\Pester.psd1 function Invoke-Pester4 ($Arguments) { diff --git a/new-runtimepoc/Pester.RSpec.ResultObject.ts.ps1 b/tst/Pester.RSpec.ResultObject.ts.ps1 similarity index 98% rename from new-runtimepoc/Pester.RSpec.ResultObject.ts.ps1 rename to tst/Pester.RSpec.ResultObject.ts.ps1 index 2eafb577d..d1fe12e00 100644 --- a/new-runtimepoc/Pester.RSpec.ResultObject.ts.ps1 +++ b/tst/Pester.RSpec.ResultObject.ts.ps1 @@ -3,9 +3,9 @@ param ([switch] $PassThru) Get-Module Pester.Runtime, Pester.Utility, P, Pester, Axiom, Stack | Remove-Module Import-Module $PSScriptRoot\p.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Dependencies\Axiom\Axiom.psm1 -DisableNameChecking +Import-Module $PSScriptRoot\axiom\Axiom.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Pester.psd1 +Import-Module $PSScriptRoot\..\bin\Pester.psd1 $global:PesterPreference = @{ diff --git a/new-runtimepoc/Pester.RSpec.ts.ps1 b/tst/Pester.RSpec.ts.ps1 similarity index 99% rename from new-runtimepoc/Pester.RSpec.ts.ps1 rename to tst/Pester.RSpec.ts.ps1 index abde2501a..3180da5fa 100644 --- a/new-runtimepoc/Pester.RSpec.ts.ps1 +++ b/tst/Pester.RSpec.ts.ps1 @@ -3,9 +3,9 @@ param ([switch] $PassThru) Get-Module Pester.Runtime, Pester.Utility, P, Pester, Axiom, Stack | Remove-Module Import-Module $PSScriptRoot\p.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Dependencies\Axiom\Axiom.psm1 -DisableNameChecking +Import-Module $PSScriptRoot\axiom\Axiom.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Pester.psd1 +Import-Module $PSScriptRoot\..\bin\Pester.psd1 $global:PesterPreference = @{ Debug = @{ diff --git a/new-runtimepoc/Pester.Rspec.Filtering.ts.ps1 b/tst/Pester.Rspec.Filtering.ts.ps1 similarity index 98% rename from new-runtimepoc/Pester.Rspec.Filtering.ts.ps1 rename to tst/Pester.Rspec.Filtering.ts.ps1 index 542c8907b..2d379ac73 100644 --- a/new-runtimepoc/Pester.Rspec.Filtering.ts.ps1 +++ b/tst/Pester.Rspec.Filtering.ts.ps1 @@ -3,9 +3,9 @@ param ([switch] $PassThru) Get-Module Pester.Runtime, Pester.Utility, P, Pester, Axiom, Stack | Remove-Module Import-Module $PSScriptRoot\p.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Dependencies\Axiom\Axiom.psm1 -DisableNameChecking +Import-Module $PSScriptRoot\axiom\Axiom.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Pester.psd1 +Import-Module $PSScriptRoot\..\bin\Pester.psd1 $global:PesterPreference = @{ Debug = @{ diff --git a/new-runtimepoc/Pester.Runtime.ResultObject.ts.ps1 b/tst/Pester.Runtime.ResultObject.ts.ps1 similarity index 97% rename from new-runtimepoc/Pester.Runtime.ResultObject.ts.ps1 rename to tst/Pester.Runtime.ResultObject.ts.ps1 index 956946734..b4a893e96 100644 --- a/new-runtimepoc/Pester.Runtime.ResultObject.ts.ps1 +++ b/tst/Pester.Runtime.ResultObject.ts.ps1 @@ -5,11 +5,11 @@ Get-Item function:wrapper -ErrorAction SilentlyContinue | remove-item Get-Module Pester.Runtime, Pester.Utility, P, Pester, Axiom | Remove-Module -Import-Module $PSScriptRoot\Pester.Runtime.psm1 -DisableNameChecking -. $PSScriptRoot\Pester.Utility.ps1 +Import-Module $PSScriptRoot\..\src\Pester.Runtime.psm1 -DisableNameChecking +. $PSScriptRoot\..\src\Pester.Utility.ps1 Import-Module $PSScriptRoot\p.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Dependencies\Axiom\Axiom.psm1 -DisableNameChecking +Import-Module $PSScriptRoot\axiom\Axiom.psm1 -DisableNameChecking $global:PesterPreference = @{ Debug = @{ diff --git a/new-runtimepoc/Pester.Runtime.ts.ps1 b/tst/Pester.Runtime.ts.ps1 similarity index 99% rename from new-runtimepoc/Pester.Runtime.ts.ps1 rename to tst/Pester.Runtime.ts.ps1 index 8dcdbb3c8..4fe8243e2 100644 --- a/new-runtimepoc/Pester.Runtime.ts.ps1 +++ b/tst/Pester.Runtime.ts.ps1 @@ -6,11 +6,11 @@ Get-Item function:wrapper -ErrorAction SilentlyContinue | remove-item Get-Module Pester.Runtime, P, Pester, Axiom, Stack | Remove-Module # Import-Module Pester -MinimumVersion 4.4.3 -. $PSScriptRoot\Pester.Utility.ps1 -Import-Module $PSScriptRoot\Pester.Runtime.psm1 -DisableNameChecking +. $PSScriptRoot\..\src\Pester.Utility.ps1 +Import-Module $PSScriptRoot\..\src\Pester.Runtime.psm1 -DisableNameChecking Import-Module $PSScriptRoot\p.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Dependencies\Axiom\Axiom.psm1 -DisableNameChecking +Import-Module $PSScriptRoot\axiom\Axiom.psm1 -DisableNameChecking $global:PesterPreference = @{ Debug = @{ diff --git a/Pester.Tests.ps1 b/tst/Pester.Tests.ps1 similarity index 97% rename from Pester.Tests.ps1 rename to tst/Pester.Tests.ps1 index 3ea6df4e5..48fdcf07f 100644 --- a/Pester.Tests.ps1 +++ b/tst/Pester.Tests.ps1 @@ -95,7 +95,7 @@ if ($PSVersionTable.PSVersion.Major -ge 3) { } } - InModuleScope Pester { + InPesterModuleScope { Describe 'SafeCommands table' { BeforeAll { $path = $ExecutionContext.SessionState.Module.ModuleBase @@ -208,7 +208,7 @@ Describe 'Style rules' -Tag StyleRules { } } -InModuleScope Pester { +InPesterModuleScope { Describe 'Find-File' { BeforeAll { New-Item -ItemType File 'TestDrive:\SomeFile.ps1' @@ -415,14 +415,8 @@ Describe 'Assertion operators' { Describe 'Set-StrictMode for all tests files' { It 'Pester tests files start with explicit declaration of StrictMode set to Latest' { - $pesterRoot = (Get-Module Pester).ModuleBase - $files = @( - Get-ChildItem $pesterRoot\* -Include *.Tests.ps1 - Get-ChildItem (Join-Path $pesterRoot 'en-US') -Include *.Tests.ps1 -Recurse - Get-ChildItem (Join-Path $pesterRoot 'Functions') -Include *.Tests.ps1 -Recurse - Get-ChildItem (Join-Path $pesterRoot 'Dependencies') -Include *.Tests.ps1 -Recurse - ) + $files = Get-ChildItem $PSScriptRoot\../tst/ -Include *.Tests.ps1 -Recurse $UnstrictTests = @( foreach ($file in $files) { @@ -436,7 +430,7 @@ Describe 'Set-StrictMode for all tests files' { } $n = 0 for ($i = 0; $i -lt $linestoRead; $i++) { - if ($lines[$i] -match '\s+Set-StrictMode\ -Version\ Latest' -or $lines[$i] -match 'Set-StrictMode\ -Version\ Latest' ) { + if ($lines[$i] -match '^\s*Set-StrictMode\s+-Version\s+Latest') { $n++ } } diff --git a/new-runtimepoc/Pester.Utility.ts.ps1 b/tst/Pester.Utility.ts.ps1 similarity index 95% rename from new-runtimepoc/Pester.Utility.ts.ps1 rename to tst/Pester.Utility.ts.ps1 index 82401785a..74d9efe2e 100644 --- a/new-runtimepoc/Pester.Utility.ts.ps1 +++ b/tst/Pester.Utility.ts.ps1 @@ -3,9 +3,9 @@ param ([switch] $PassThru) Get-Module Pester.Utility, P, Axiom | Remove-Module Import-Module $PSScriptRoot\p.psm1 -DisableNameChecking -Import-Module $PSScriptRoot\..\Dependencies\Axiom\Axiom.psm1 -DisableNameChecking +Import-Module $PSScriptRoot\axiom\Axiom.psm1 -DisableNameChecking -. $PSScriptRoot\Pester.Utility.ps1 +. $PSScriptRoot\..\src\Pester.Utility.ps1 i -PassThru:$PassThru { b "Merging objects" { diff --git a/new-runtimepoc/ReloadAndInvokePester.ps1 b/tst/ReloadAndInvokePester.ps1 similarity index 100% rename from new-runtimepoc/ReloadAndInvokePester.ps1 rename to tst/ReloadAndInvokePester.ps1 diff --git a/Dependencies/TypeClass/TypeClass.Tests.ps1 b/tst/TypeClass.Tests.ps1 similarity index 95% rename from Dependencies/TypeClass/TypeClass.Tests.ps1 rename to tst/TypeClass.Tests.ps1 index d6dfc114b..8b92ab7c7 100644 --- a/Dependencies/TypeClass/TypeClass.Tests.ps1 +++ b/tst/TypeClass.Tests.ps1 @@ -1,8 +1,6 @@ Set-StrictMode -Version Latest -$here = $MyInvocation.MyCommand.Path | Split-Path -Import-Module $here/TypeClass.psm1 -DisableNameChecking - +# BeforeDiscovery function New-Dictionary ([hashtable]$Hashtable) { $d = new-object "Collections.Generic.Dictionary[string,object]" @@ -11,6 +9,10 @@ function New-Dictionary ([hashtable]$Hashtable) { $d } +BeforeAll { + Import-Module $PSScriptRoot\../src/TypeClass.psm1 -DisableNameChecking +} + Describe "Is-Value" { It "Given '', which is a value, string, enum, scriptblock or array with a single item of those types it returns `$true" -TestCases @( @{ Value = 1 }, @@ -134,7 +136,7 @@ Describe "Is-Collection" { @{ Value = [System.Collections.Generic.List[int]]([int[]] 1) } @{ Value = [System.Collections.Generic.List[decimal]]([decimal[]] 2D) } @{ Value = [Collections.Generic.List[Int]]([int[]](1, 2, 3)) } - @{ Value = (Get-Process) } + # @{ Value = (Get-Process) } <- fails in docker because there is just one process ) { param($Value) Is-Collection -Value $Value | Verify-True diff --git a/Dependencies/Axiom/Axiom.psm1 b/tst/axiom/Axiom.psm1 similarity index 100% rename from Dependencies/Axiom/Axiom.psm1 rename to tst/axiom/Axiom.psm1 diff --git a/Dependencies/Axiom/Verify-AssertionFailed.ps1 b/tst/axiom/Verify-AssertionFailed.ps1 similarity index 100% rename from Dependencies/Axiom/Verify-AssertionFailed.ps1 rename to tst/axiom/Verify-AssertionFailed.ps1 diff --git a/Dependencies/Axiom/Verify-Equal.ps1 b/tst/axiom/Verify-Equal.ps1 similarity index 100% rename from Dependencies/Axiom/Verify-Equal.ps1 rename to tst/axiom/Verify-Equal.ps1 diff --git a/Dependencies/Axiom/Verify-False.ps1 b/tst/axiom/Verify-False.ps1 similarity index 100% rename from Dependencies/Axiom/Verify-False.ps1 rename to tst/axiom/Verify-False.ps1 diff --git a/Dependencies/Axiom/Verify-NotNull.ps1 b/tst/axiom/Verify-NotNull.ps1 similarity index 100% rename from Dependencies/Axiom/Verify-NotNull.ps1 rename to tst/axiom/Verify-NotNull.ps1 diff --git a/Dependencies/Axiom/Verify-NotSame.ps1 b/tst/axiom/Verify-NotSame.ps1 similarity index 100% rename from Dependencies/Axiom/Verify-NotSame.ps1 rename to tst/axiom/Verify-NotSame.ps1 diff --git a/Dependencies/Axiom/Verify-Null.ps1 b/tst/axiom/Verify-Null.ps1 similarity index 100% rename from Dependencies/Axiom/Verify-Null.ps1 rename to tst/axiom/Verify-Null.ps1 diff --git a/Dependencies/Axiom/Verify-Same.ps1 b/tst/axiom/Verify-Same.ps1 similarity index 100% rename from Dependencies/Axiom/Verify-Same.ps1 rename to tst/axiom/Verify-Same.ps1 diff --git a/Dependencies/Axiom/Verify-Throw.ps1 b/tst/axiom/Verify-Throw.ps1 similarity index 100% rename from Dependencies/Axiom/Verify-Throw.ps1 rename to tst/axiom/Verify-Throw.ps1 diff --git a/Dependencies/Axiom/Verify-True.ps1 b/tst/axiom/Verify-True.ps1 similarity index 100% rename from Dependencies/Axiom/Verify-True.ps1 rename to tst/axiom/Verify-True.ps1 diff --git a/Dependencies/Axiom/Verify-Type.ps1 b/tst/axiom/Verify-Type.ps1 similarity index 100% rename from Dependencies/Axiom/Verify-Type.ps1 rename to tst/axiom/Verify-Type.ps1 diff --git a/Functions/BreakAndContinue.Tests.ps1 b/tst/functions/BreakAndContinue.Tests.ps1 similarity index 100% rename from Functions/BreakAndContinue.Tests.ps1 rename to tst/functions/BreakAndContinue.Tests.ps1 diff --git a/Functions/Context.Tests.ps1 b/tst/functions/Context.Tests.ps1 similarity index 100% rename from Functions/Context.Tests.ps1 rename to tst/functions/Context.Tests.ps1 diff --git a/Functions/Coverage.Tests.ps1 b/tst/functions/Coverage.Tests.ps1 similarity index 98% rename from Functions/Coverage.Tests.ps1 rename to tst/functions/Coverage.Tests.ps1 index a931f805d..2fa3695b9 100644 --- a/Functions/Coverage.Tests.ps1 +++ b/tst/functions/Coverage.Tests.ps1 @@ -1,20 +1,14 @@ Set-StrictMode -Version Latest -if ($PSVersionTable.PSVersion.Major -le 2) { - return -} - -InModuleScope Pester { - BeforeAll { - function Clear-WhiteSpace ($Text) { - # clear whitespace in formatted xml so we can keep the XML in the test file - # formatted and easily see changes in source control - "$($Text -replace "(`t|`n|`r)"," " -replace "\s+"," " -replace "\s*<","<" -replace ">\s*", ">")".Trim() - } - } - +InPesterModuleScope { Describe 'Code Coverage Analysis' { BeforeAll { + function Clear-WhiteSpace ($Text) { + # clear whitespace in formatted xml so we can keep the XML in the test file + # formatted and easily see changes in source control + "$($Text -replace "(`t|`n|`r)"," " -replace "\s+"," " -replace "\s*<","<" -replace ">\s*", ">")".Trim() + } + $root = (Get-PSDrive TestDrive).Root $rootSubFolder = Join-Path -Path $root -ChildPath TestSubFolder diff --git a/Functions/Describe.Tests.ps1 b/tst/functions/Describe.Tests.ps1 similarity index 99% rename from Functions/Describe.Tests.ps1 rename to tst/functions/Describe.Tests.ps1 index 9bdf9ddba..2ae248c4a 100644 --- a/Functions/Describe.Tests.ps1 +++ b/tst/functions/Describe.Tests.ps1 @@ -44,7 +44,7 @@ return # TODO: Those are tests for Describe, and they test the actual behavior by combining the test code with the code that is being tested. This makes the tests pretty confusing because the same vocabulary is used for the tests and the tested code. Most of this should already be tested in the runtime tests, but let's keep it for further reference. Ideally this would be rewritten to P. -InModuleScope Pester { +InPesterModuleScope { Describe 'Describe - Implementation' { BeforeAll { # Function / mock used for call history tracking and assertion purposes only. diff --git a/Functions/Environment.Tests.ps1 b/tst/functions/Environment.Tests.ps1 similarity index 100% rename from Functions/Environment.Tests.ps1 rename to tst/functions/Environment.Tests.ps1 diff --git a/Functions/Get-ShouldOperator.Tests.ps1 b/tst/functions/Get-ShouldOperator.Tests.ps1 similarity index 98% rename from Functions/Get-ShouldOperator.Tests.ps1 rename to tst/functions/Get-ShouldOperator.Tests.ps1 index ea2befd64..8c948f7de 100644 --- a/Functions/Get-ShouldOperator.Tests.ps1 +++ b/tst/functions/Get-ShouldOperator.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe 'Get-ShouldOperator' { Context 'Overview' { diff --git a/Functions/GlobalMock-A.Tests.ps1 b/tst/functions/GlobalMock-A.Tests.ps1 similarity index 100% rename from Functions/GlobalMock-A.Tests.ps1 rename to tst/functions/GlobalMock-A.Tests.ps1 diff --git a/Functions/GlobalMock-B.Tests.ps1 b/tst/functions/GlobalMock-B.Tests.ps1 similarity index 100% rename from Functions/GlobalMock-B.Tests.ps1 rename to tst/functions/GlobalMock-B.Tests.ps1 diff --git a/Functions/In.Tests.ps1 b/tst/functions/In.Tests.ps1 similarity index 96% rename from Functions/In.Tests.ps1 rename to tst/functions/In.Tests.ps1 index b592ba33d..07b2bf51b 100644 --- a/Functions/In.Tests.ps1 +++ b/tst/functions/In.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "the In statement" { BeforeAll { New-Item -ItemType Directory "TestDrive:\test_path" diff --git a/Functions/InModuleScope.Tests.ps1 b/tst/functions/InModuleScope.Tests.ps1 similarity index 100% rename from Functions/InModuleScope.Tests.ps1 rename to tst/functions/InModuleScope.Tests.ps1 diff --git a/Functions/It.Tests.ps1 b/tst/functions/It.Tests.ps1 similarity index 97% rename from Functions/It.Tests.ps1 rename to tst/functions/It.Tests.ps1 index 030985f05..132fc5f41 100644 --- a/Functions/It.Tests.ps1 +++ b/tst/functions/It.Tests.ps1 @@ -5,7 +5,7 @@ return -InModuleScope Pester { +InPesterModuleScope { Describe 'It - Implementation' { $testState = New-PesterState -Path $TestDrive @@ -90,7 +90,7 @@ InModuleScope Pester { Remove-Variable -Scope Script -Name counterNameThatIsReallyUnlikelyToConflictWithAnything Context 'Parameterized Tests' { - # be careful about variable naming here; with InModuleScope Pester, we can create the same types of bugs that the v3 + # be careful about variable naming here; with InPesterModuleScope, we can create the same types of bugs that the v3 # scope isolation fixed for everyone else. (Naming this variable $testCases gets hidden later by parameters of the # same name in It.) diff --git a/Functions/Mock.Tests.ps1 b/tst/functions/Mock.Tests.ps1 similarity index 99% rename from Functions/Mock.Tests.ps1 rename to tst/functions/Mock.Tests.ps1 index e1390092b..afa082c10 100644 --- a/Functions/Mock.Tests.ps1 +++ b/tst/functions/Mock.Tests.ps1 @@ -934,7 +934,7 @@ Describe 'Dot Source Test' { } It "Doesn't call the mock with any other parameters" { - InModuleScope Pester { + InPesterModuleScope { $global:calls = $mockTable['||Test-Path'].CallHistory } Should -Invoke Test-Path -Exactly 0 -ParameterFilter { $Path -ne 'Test' } -Scope Describe @@ -944,7 +944,7 @@ Describe 'Dot Source Test' { Describe 'Mocking Cmdlets with dynamic parameters' { Context 'Get-ChildItem' { - if ((InModuleScope Pester { GetPesterOs }) -ne 'Windows') { + if ((InPesterModuleScope { GetPesterOs }) -ne 'Windows') { BeforeAll { $mockWith = { if (-not $Hidden) { throw 'Hidden variable not found, or set to false!' @@ -1360,7 +1360,7 @@ Describe 'Mocking functions with dynamic parameters' { Describe 'Mocking Cmdlets with dynamic parameters in a module' { BeforeAll { - if ((InModuleScope Pester {GetPesterOs}) -ne 'Windows') { + if ((InPesterModuleScope {GetPesterOs}) -ne 'Windows') { New-Module -Name TestModule { function PublicFunction { Get-ChildItem -Path \ -Hidden @@ -1398,7 +1398,7 @@ Describe 'Mocking Cmdlets with dynamic parameters in a module' { Describe 'DynamicParam blocks in other scopes' { BeforeAll { - if ((InModuleScope Pester {GetPesterOs})-ne 'Windows') { + if ((InPesterModuleScope {GetPesterOs})-ne 'Windows') { New-Module -Name TestModule1 { $script:DoDynamicParam = $true @@ -1413,7 +1413,7 @@ Describe 'DynamicParam blocks in other scopes' { $params = $PSBoundParameters.GetType().GetConstructor($flags, $null, @(), $null).Invoke(@()) $params['Path'] = [string[]]'/' - $gmdp = InModuleScope Pester { Get-Command Get-MockDynamicParameter } + $gmdp = InPesterModuleScope { Get-Command Get-MockDynamicParameter } & $gmdp -CmdletName Get-ChildItem -Parameters $params -InputArgs @('-Path', '/') } } @@ -1466,7 +1466,7 @@ Describe 'DynamicParam blocks in other scopes' { } $params['Path'] = [string[]]'Cert:\' - $gmdp = InModuleScope Pester { Get-Command Get-MockDynamicParameter } + $gmdp = InPesterModuleScope { Get-Command Get-MockDynamicParameter } & $gmdp -CmdletName Get-ChildItem -Parameters $params -InputArgs @('-Path', 'Cert:\') } } @@ -2178,7 +2178,7 @@ Describe "Mocking Set-Variable" { } Describe "Mocking functions with conflicting parameters" { - InModuleScope Pester { + InPesterModuleScope { Context "Faked conflicting parameter" { BeforeAll { Mock Get-ConflictingParameterNames { @("ParamToAvoid") } @@ -2292,7 +2292,7 @@ if ($PSVersionTable.PSVersion.Major -ge 3) { } -InModuleScope Pester { +InPesterModuleScope { Describe 'Alias for external commands' { Context 'Without extensions' { $case = @( diff --git a/Functions/New-MockObject.Tests.ps1 b/tst/functions/New-MockObject.Tests.ps1 similarity index 100% rename from Functions/New-MockObject.Tests.ps1 rename to tst/functions/New-MockObject.Tests.ps1 diff --git a/Functions/OuterMock.Tests.ps1 b/tst/functions/OuterMock.Tests.ps1 similarity index 100% rename from Functions/OuterMock.Tests.ps1 rename to tst/functions/OuterMock.Tests.ps1 diff --git a/Functions/Output.Tests.ps1 b/tst/functions/Output.Tests.ps1 similarity index 95% rename from Functions/Output.Tests.ps1 rename to tst/functions/Output.Tests.ps1 index 9d6653fa9..e69524567 100644 --- a/Functions/Output.Tests.ps1 +++ b/tst/functions/Output.Tests.ps1 @@ -69,7 +69,7 @@ BeforeAll { # not used but might be useful for future reference # Describe 'ConvertTo-PesterResult' { # BeforeAll { -# $getPesterResult = InModuleScope Pester { ${function:ConvertTo-PesterResult} } +# $getPesterResult = InPesterModuleScope { ${function:ConvertTo-PesterResult} } # } # Context 'failed tests in Tests file' { @@ -271,7 +271,7 @@ InModuleScope -ModuleName Pester -ScriptBlock { # It 'produces correct trace lines.' { # if ($hasStackTrace) { # $r.Trace[0] | Should -be "at , $testPath`: line 2" -# $r.Trace[1] -match 'at , .*\\Functions\\Output.Tests.ps1: line [0-9]*$' | +# $r.Trace[1] -match 'at , .*\\functions\\Output.Tests.ps1: line [0-9]*$' | # Should -be $true # $r.Trace.Count | Should -be 3 # } @@ -319,7 +319,8 @@ InModuleScope -ModuleName Pester -ScriptBlock { $r.Trace[0] | Should -be "at f1, ${testPath}:2" $r.Trace[1] | Should -be "at f2, ${testPath}:5" $r.Trace[2] | Should -be "at , ${testPath}:7" - $r.Trace.Count | Should -be 3 + $r.Trace[3] | Should -be "at , ${PSCommandPath}:302" + $r.Trace.Count | Should -be 4 } } } @@ -329,7 +330,8 @@ InModuleScope -ModuleName Pester -ScriptBlock { $r.Trace[0] | Should -be "at f1, ${testPath}:2" $r.Trace[1] | Should -be "at f2, ${testPath}:5" $r.Trace[2] | Should -be "at , ${testPath}:7" - $r.Trace.Count | Should -be 3 + $r.Trace[3] | Should -be "at , ${PSCommandPath}:302" + $r.Trace.Count | Should -be 4 } } } @@ -389,7 +391,8 @@ InModuleScope -ModuleName Pester -ScriptBlock { It 'produces correct trace line.' { if ($hasStackTrace) { $r.Trace[0] | Should -be "at , $testPath`:10" - $r.Trace.Count | Should -be 1 + $r.Trace[1] | Should -be "at , $PSCommandPath`:368" + $r.Trace.Count | Should -be 2 } } } @@ -397,7 +400,8 @@ InModuleScope -ModuleName Pester -ScriptBlock { It 'produces correct trace line.' { if ($hasStackTrace) { $r.Trace[0] | Should -be "at , $testPath`:10" - $r.Trace.Count | Should -be 1 + $r.Trace[1] | Should -be "at , $PSCommandPath`:368" + $r.Trace.Count | Should -be 2 } } } @@ -427,7 +431,7 @@ InModuleScope -ModuleName Pester -ScriptBlock { } It 'produces correct trace line' { - $r.Trace.Count | Should -Be 0 + $r.Trace.Count | Should -Be 1 } } } diff --git a/Functions/PesterState.Tests.ps1 b/tst/functions/PesterState.Tests.ps1 similarity index 99% rename from Functions/PesterState.Tests.ps1 rename to tst/functions/PesterState.Tests.ps1 index f9443bb55..ff413ec05 100644 --- a/Functions/PesterState.Tests.ps1 +++ b/tst/functions/PesterState.Tests.ps1 @@ -2,7 +2,7 @@ return Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "New-PesterState" { Context "TestNameFilter parameter is set" { $p = new-pesterstate -TestNameFilter "filter" diff --git a/Functions/Set-ItResult.Tests.ps1 b/tst/functions/Set-ItResult.Tests.ps1 similarity index 100% rename from Functions/Set-ItResult.Tests.ps1 rename to tst/functions/Set-ItResult.Tests.ps1 diff --git a/Functions/SetupTeardown.Tests.ps1 b/tst/functions/SetupTeardown.Tests.ps1 similarity index 99% rename from Functions/SetupTeardown.Tests.ps1 rename to tst/functions/SetupTeardown.Tests.ps1 index ed89ea6d5..0639f92da 100644 --- a/Functions/SetupTeardown.Tests.ps1 +++ b/tst/functions/SetupTeardown.Tests.ps1 @@ -200,7 +200,7 @@ Describe 'Finishing TestGroup Setup and Teardown tests' { # $commandPath = $PSCommandPath # } -# $beforeEachBlock = InModuleScope Pester { +# $beforeEachBlock = InPesterModuleScope { # $pester.CurrentTestGroup.BeforeEach[0] # } diff --git a/Functions/TestDrive.Tests.ps1 b/tst/functions/TestDrive.Tests.ps1 similarity index 98% rename from Functions/TestDrive.Tests.ps1 rename to tst/functions/TestDrive.Tests.ps1 index e79ec5ba3..f98ae16cd 100644 --- a/Functions/TestDrive.Tests.ps1 +++ b/tst/functions/TestDrive.Tests.ps1 @@ -39,7 +39,6 @@ Describe "TestDrive scoping" { } It "Describe file is still available in Describe" { - Write-Host ($describe) $describe | Should -Exist } } @@ -88,7 +87,7 @@ Describe "Cleanup when Remove-Item is mocked" { } } -InModuleScope Pester { +InPesterModuleScope { Describe "New-RandomTempDirectory" { It "creates randomly named directory" { $first = New-RandomTempDirectory @@ -104,7 +103,7 @@ InModuleScope Pester { } # Tests problematic symlinks, but needs to run as admin -# InModuleScope Pester { +# InPesterModuleScope { # Describe "Clear-TestDrive" { diff --git a/Functions/TestRegistry.Tests.ps1 b/tst/functions/TestRegistry.Tests.ps1 similarity index 100% rename from Functions/TestRegistry.Tests.ps1 rename to tst/functions/TestRegistry.Tests.ps1 diff --git a/Functions/TestResults.Tests.ps1 b/tst/functions/TestResults.Tests.ps1 similarity index 99% rename from Functions/TestResults.Tests.ps1 rename to tst/functions/TestResults.Tests.ps1 index aa1d3c11e..45c4fb0b9 100644 --- a/Functions/TestResults.Tests.ps1 +++ b/tst/functions/TestResults.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Get-TestTime" { BeforeAll { function Using-Culture { diff --git a/Functions/TestsRunningInCleanRunspace.Tests.ps1 b/tst/functions/TestsRunningInCleanRunspace.Tests.ps1 similarity index 100% rename from Functions/TestsRunningInCleanRunspace.Tests.ps1 rename to tst/functions/TestsRunningInCleanRunspace.Tests.ps1 diff --git a/Functions/Assertions/Be.Tests.ps1 b/tst/functions/assertions/Be.Tests.ps1 similarity index 99% rename from Functions/Assertions/Be.Tests.ps1 rename to tst/functions/assertions/Be.Tests.ps1 index 7d5d1f954..4f1268682 100644 --- a/Functions/Assertions/Be.Tests.ps1 +++ b/tst/functions/assertions/Be.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -Be" { It "returns true if the 2 arguments are equal" { @@ -156,7 +156,7 @@ InModuleScope Pester { } } -InModuleScope Pester { +InPesterModuleScope { Describe "Should -BeExactly" { It "passes if letter case matches" { 'a' | Should -BeExactly 'a' diff --git a/Functions/Assertions/BeGreaterThan.Tests.ps1 b/tst/functions/assertions/BeGreaterThan.Tests.ps1 similarity index 99% rename from Functions/Assertions/BeGreaterThan.Tests.ps1 rename to tst/functions/assertions/BeGreaterThan.Tests.ps1 index a8fc36252..7e098d482 100644 --- a/Functions/Assertions/BeGreaterThan.Tests.ps1 +++ b/tst/functions/assertions/BeGreaterThan.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -BeGreaterThan" { It "passes if value greater than expected" { diff --git a/Functions/Assertions/BeIn.Tests.ps1 b/tst/functions/assertions/BeIn.Tests.ps1 similarity index 98% rename from Functions/Assertions/BeIn.Tests.ps1 rename to tst/functions/assertions/BeIn.Tests.ps1 index 360424657..077ce54e7 100644 --- a/Functions/Assertions/BeIn.Tests.ps1 +++ b/tst/functions/assertions/BeIn.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -BeIn" { It "passes if value is in the collection" { diff --git a/Functions/Assertions/BeLessThan.Tests.ps1 b/tst/functions/assertions/BeLessThan.Tests.ps1 similarity index 99% rename from Functions/Assertions/BeLessThan.Tests.ps1 rename to tst/functions/assertions/BeLessThan.Tests.ps1 index 8598573a5..b1ef5b57a 100644 --- a/Functions/Assertions/BeLessThan.Tests.ps1 +++ b/tst/functions/assertions/BeLessThan.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -BeLessThan" { It "passes if value is less than expected" { diff --git a/Functions/Assertions/BeLike.Tests.ps1 b/tst/functions/assertions/BeLike.Tests.ps1 similarity index 98% rename from Functions/Assertions/BeLike.Tests.ps1 rename to tst/functions/assertions/BeLike.Tests.ps1 index 5843a05a7..021bea80a 100644 --- a/Functions/Assertions/BeLike.Tests.ps1 +++ b/tst/functions/assertions/BeLike.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -BeLike" { It "passes for things that are like wildcard" { diff --git a/Functions/Assertions/BeLikeExactly.Tests.ps1 b/tst/functions/assertions/BeLikeExactly.Tests.ps1 similarity index 98% rename from Functions/Assertions/BeLikeExactly.Tests.ps1 rename to tst/functions/assertions/BeLikeExactly.Tests.ps1 index cb67c8927..5b977bba6 100644 --- a/Functions/Assertions/BeLikeExactly.Tests.ps1 +++ b/tst/functions/assertions/BeLikeExactly.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -BeLikeExactly" { It "passes for things that are like wildcard" { diff --git a/Functions/Assertions/BeNullOrEmpty.Tests.ps1 b/tst/functions/assertions/BeNullOrEmpty.Tests.ps1 similarity index 98% rename from Functions/Assertions/BeNullOrEmpty.Tests.ps1 rename to tst/functions/assertions/BeNullOrEmpty.Tests.ps1 index 6412a37e3..8f35b9400 100644 --- a/Functions/Assertions/BeNullOrEmpty.Tests.ps1 +++ b/tst/functions/assertions/BeNullOrEmpty.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -BeNullOrEmpty" { It "should return true if null" { diff --git a/Functions/Assertions/BeOfType.Tests.ps1 b/tst/functions/assertions/BeOfType.Tests.ps1 similarity index 98% rename from Functions/Assertions/BeOfType.Tests.ps1 rename to tst/functions/assertions/BeOfType.Tests.ps1 index 45262d7fc..7f20fd9e5 100644 --- a/Functions/Assertions/BeOfType.Tests.ps1 +++ b/tst/functions/assertions/BeOfType.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -BeOfType" { It "passes if value is of the expected type" { diff --git a/Functions/Assertions/BeTrueOrFalse.Tests.ps1 b/tst/functions/assertions/BeTrueOrFalse.Tests.ps1 similarity index 99% rename from Functions/Assertions/BeTrueOrFalse.Tests.ps1 rename to tst/functions/assertions/BeTrueOrFalse.Tests.ps1 index 7a26114e2..a68287dc3 100644 --- a/Functions/Assertions/BeTrueOrFalse.Tests.ps1 +++ b/tst/functions/assertions/BeTrueOrFalse.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -BeTrue" { Context "Basic functionality" { diff --git a/Functions/Assertions/Contain.Tests.ps1 b/tst/functions/assertions/Contain.Tests.ps1 similarity index 98% rename from Functions/Assertions/Contain.Tests.ps1 rename to tst/functions/assertions/Contain.Tests.ps1 index 17d4c5f4a..27e67b189 100644 --- a/Functions/Assertions/Contain.Tests.ps1 +++ b/tst/functions/assertions/Contain.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -Contain" { It "passes if collection contains the value" { diff --git a/Functions/Assertions/Exist.Tests.ps1 b/tst/functions/assertions/Exist.Tests.ps1 similarity index 98% rename from Functions/Assertions/Exist.Tests.ps1 rename to tst/functions/assertions/Exist.Tests.ps1 index 5032ce11d..b34c93652 100644 --- a/Functions/Assertions/Exist.Tests.ps1 +++ b/tst/functions/assertions/Exist.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -Exist" { It "returns true for paths that exist" { diff --git a/Functions/Assertions/FileContentMatch.Tests.ps1 b/tst/functions/assertions/FileContentMatch.Tests.ps1 similarity index 98% rename from Functions/Assertions/FileContentMatch.Tests.ps1 rename to tst/functions/assertions/FileContentMatch.Tests.ps1 index 25d43b21f..80db3b7fa 100644 --- a/Functions/Assertions/FileContentMatch.Tests.ps1 +++ b/tst/functions/assertions/FileContentMatch.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -FileContentMatch" { Context "when testing file contents" { diff --git a/Functions/Assertions/FileContentMatchExactly.Tests.ps1 b/tst/functions/assertions/FileContentMatchExactly.Tests.ps1 similarity index 98% rename from Functions/Assertions/FileContentMatchExactly.Tests.ps1 rename to tst/functions/assertions/FileContentMatchExactly.Tests.ps1 index 7921c5c14..3f4b54ed9 100644 --- a/Functions/Assertions/FileContentMatchExactly.Tests.ps1 +++ b/tst/functions/assertions/FileContentMatchExactly.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -FileContentMatchExactly" { Context "when testing file contents" { diff --git a/Functions/Assertions/FileContentMatchMultiline.Tests.ps1 b/tst/functions/assertions/FileContentMatchMultiline.Tests.ps1 similarity index 98% rename from Functions/Assertions/FileContentMatchMultiline.Tests.ps1 rename to tst/functions/assertions/FileContentMatchMultiline.Tests.ps1 index f1e7a4072..cc676cfaa 100644 --- a/Functions/Assertions/FileContentMatchMultiline.Tests.ps1 +++ b/tst/functions/assertions/FileContentMatchMultiline.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -FileContentMatchMultiline" { Context "when testing file contents" { diff --git a/Functions/Assertions/HaveCount.Tests.ps1 b/tst/functions/assertions/HaveCount.Tests.ps1 similarity index 99% rename from Functions/Assertions/HaveCount.Tests.ps1 rename to tst/functions/assertions/HaveCount.Tests.ps1 index fd2aec505..7deac20e6 100644 --- a/Functions/Assertions/HaveCount.Tests.ps1 +++ b/tst/functions/assertions/HaveCount.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -HaveCount" { It "passes if collection has the expected amount of items" { diff --git a/Functions/Assertions/HaveParameter.Tests.ps1 b/tst/functions/assertions/HaveParameter.Tests.ps1 similarity index 86% rename from Functions/Assertions/HaveParameter.Tests.ps1 rename to tst/functions/assertions/HaveParameter.Tests.ps1 index 9f6baa7ad..a1ba4ea7a 100644 --- a/Functions/Assertions/HaveParameter.Tests.ps1 +++ b/tst/functions/assertions/HaveParameter.Tests.ps1 @@ -1,88 +1,87 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { - BeforeAll { - $functionsBlock = { - if ($PSVersionTable.PSVersion.Major -ge 5) { - function Invoke-DummyFunction { - param( - [Parameter(Mandatory = $true)] - $MandatoryParam, - - [ValidateNotNullOrEmpty()] - [DateTime]$ParamWithNotNullOrEmptyValidation = (Get-Date), - - [Parameter()] - [ValidateScript( - { - if (-not (Test-Path $_)) { - $errorItem = [System.Management.Automation.ErrorRecord]::new( - ([System.ArgumentException]"Path not found"), - 'ParameterValue.FileNotFound', - [System.Management.Automation.ErrorCategory]::ObjectNotFound, - $_ - ) - $errorItem.ErrorDetails = "Invalid path '$_'." - $PSCmdlet.ThrowTerminatingError($errorItem) - } - else { - return $true - } + # not using BeforeAll here, because it does not work in Pester itself + $global:functionsBlock = { + if ($PSVersionTable.PSVersion.Major -ge 5) { + function Invoke-DummyFunction { + param( + [Parameter(Mandatory = $true)] + $MandatoryParam, + + [ValidateNotNullOrEmpty()] + [DateTime]$ParamWithNotNullOrEmptyValidation = (Get-Date), + + [Parameter()] + [ValidateScript( + { + if (-not (Test-Path $_)) { + $errorItem = [System.Management.Automation.ErrorRecord]::new( + ([System.ArgumentException]"Path not found"), + 'ParameterValue.FileNotFound', + [System.Management.Automation.ErrorCategory]::ObjectNotFound, + $_ + ) + $errorItem.ErrorDetails = "Invalid path '$_'." + $PSCmdlet.ThrowTerminatingError($errorItem) } - )] - [String]$ParamWithScriptValidation = ".", - - [Parameter()] - [ValidateNotNullOrEmpty()] - [ArgumentCompleter( - { - param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) - & Get-ChildItem | - Where-Object { $_.Name -like "$wordToComplete*" } | - ForEach-Object { [System.Management.Automation.CompletionResult]::new( $_.Name, $_.Name, [System.Management.Automation.CompletionResultType]::ParameterValue, $_.Name ) } + else { + return $true } - )] - [String]$ParamWithArgumentCompleter = "./.git" - ) - } + } + )] + [String]$ParamWithScriptValidation = ".", + + [Parameter()] + [ValidateNotNullOrEmpty()] + [ArgumentCompleter( + { + param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) + & Get-ChildItem | + Where-Object { $_.Name -like "$wordToComplete*" } | + ForEach-Object { [System.Management.Automation.CompletionResult]::new( $_.Name, $_.Name, [System.Management.Automation.CompletionResultType]::ParameterValue, $_.Name ) } + } + )] + [String]$ParamWithArgumentCompleter = "./.git" + ) } - else { - function Invoke-DummyFunction { - param( - [Parameter(Mandatory = $true)] - $MandatoryParam, - - [ValidateNotNullOrEmpty()] - [DateTime]$ParamWithNotNullOrEmptyValidation = (Get-Date), - - # argument completer is PowerShell v5+ only - [Parameter()] - [ValidateScript( - { - if (-not (Test-Path $_)) { - $errorItem = [System.Management.Automation.ErrorRecord]::new( - ([System.ArgumentException]"Path not found"), - 'ParameterValue.FileNotFound', - [System.Management.Automation.ErrorCategory]::ObjectNotFound, - $_ - ) - $errorItem.ErrorDetails = "Invalid path '$_'." - $PSCmdlet.ThrowTerminatingError($errorItem) - } - else { - return $true - } + } + else { + function Invoke-DummyFunction { + param( + [Parameter(Mandatory = $true)] + $MandatoryParam, + + [ValidateNotNullOrEmpty()] + [DateTime]$ParamWithNotNullOrEmptyValidation = (Get-Date), + + # argument completer is PowerShell v5+ only + [Parameter()] + [ValidateScript( + { + if (-not (Test-Path $_)) { + $errorItem = [System.Management.Automation.ErrorRecord]::new( + ([System.ArgumentException]"Path not found"), + 'ParameterValue.FileNotFound', + [System.Management.Automation.ErrorCategory]::ObjectNotFound, + $_ + ) + $errorItem.ErrorDetails = "Invalid path '$_'." + $PSCmdlet.ThrowTerminatingError($errorItem) } - )] - [String]$ParamWithScriptValidation = "." - ) - } + else { + return $true + } + } + )] + [String]$ParamWithScriptValidation = "." + ) } + } - function Invoke-EmptyFunction { - param() - } + function Invoke-EmptyFunction { + param() } } diff --git a/Functions/Assertions/Match.Tests.ps1 b/tst/functions/assertions/Match.Tests.ps1 similarity index 98% rename from Functions/Assertions/Match.Tests.ps1 rename to tst/functions/assertions/Match.Tests.ps1 index b44d08a38..d7626b435 100644 --- a/Functions/Assertions/Match.Tests.ps1 +++ b/tst/functions/assertions/Match.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -Match" { It "returns true for things that match" { diff --git a/Functions/Assertions/MatchExactly.Tests.ps1 b/tst/functions/assertions/MatchExactly.Tests.ps1 similarity index 98% rename from Functions/Assertions/MatchExactly.Tests.ps1 rename to tst/functions/assertions/MatchExactly.Tests.ps1 index 656d8e3e5..e3e1885b2 100644 --- a/Functions/Assertions/MatchExactly.Tests.ps1 +++ b/tst/functions/assertions/MatchExactly.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -MatchExactly" { It "returns true for things that match exactly" { diff --git a/Functions/Assertions/PesterThrow.Tests.ps1 b/tst/functions/assertions/PesterThrow.Tests.ps1 similarity index 99% rename from Functions/Assertions/PesterThrow.Tests.ps1 rename to tst/functions/assertions/PesterThrow.Tests.ps1 index fa5a0d324..16225216a 100644 --- a/Functions/Assertions/PesterThrow.Tests.ps1 +++ b/tst/functions/assertions/PesterThrow.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe "Should -Throw" { Context "Basic functionality" { diff --git a/Functions/Assertions/Should.Tests.ps1 b/tst/functions/assertions/Should.Tests.ps1 similarity index 99% rename from Functions/Assertions/Should.Tests.ps1 rename to tst/functions/assertions/Should.Tests.ps1 index 1ead478cc..f331f7dc5 100644 --- a/Functions/Assertions/Should.Tests.ps1 +++ b/tst/functions/assertions/Should.Tests.ps1 @@ -1,6 +1,6 @@ Set-StrictMode -Version Latest -InModuleScope Pester { +InPesterModuleScope { Describe -Tag "Acceptance" "Should" { It "can use the Be assertion" { diff --git a/new-runtimepoc/p.psm1 b/tst/p.psm1 similarity index 100% rename from new-runtimepoc/p.psm1 rename to tst/p.psm1 diff --git a/new-runtimepoc/TestProjects/BasicTests/folder1/file1.Tests.ps1 b/tst/testProjects/BasicTests/folder1/file1.Tests.ps1 similarity index 80% rename from new-runtimepoc/TestProjects/BasicTests/folder1/file1.Tests.ps1 rename to tst/testProjects/BasicTests/folder1/file1.Tests.ps1 index 0dc745abd..3868b0f05 100644 --- a/new-runtimepoc/TestProjects/BasicTests/folder1/file1.Tests.ps1 +++ b/tst/testProjects/BasicTests/folder1/file1.Tests.ps1 @@ -1,3 +1,5 @@ +Set-StrictMode -Version Latest + Describe "describe state tests" { It "passing" { 1 | Should -Be 1 diff --git a/new-runtimepoc/TestProjects/BasicTests/folder2/file1.Tests.ps1 b/tst/testProjects/BasicTests/folder2/file1.Tests.ps1 similarity index 82% rename from new-runtimepoc/TestProjects/BasicTests/folder2/file1.Tests.ps1 rename to tst/testProjects/BasicTests/folder2/file1.Tests.ps1 index 7436c1fc3..f4f4d0f34 100644 --- a/new-runtimepoc/TestProjects/BasicTests/folder2/file1.Tests.ps1 +++ b/tst/testProjects/BasicTests/folder2/file1.Tests.ps1 @@ -1,3 +1,5 @@ +Set-StrictMode -Version Latest + Describe "describe filterable tests" { It "untagged it" {