Common meta tests for PowerShell DSC resources repositories.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
- Extra whitespace trimmed from TestHelper.psm1 (feature of VS Code).
- Removed code to Remove-Module from Initialize-TestEnvironment because not required: Import-Module -force should do the same thing.
- Initialize-TestEnvironment changed to import module being tested into Global scope so that InModuleScope not required in tests.
- Fixed aliases in files
- Initialize-TestEnvironment changed to update the execution policy for the current process only
- Restore-TestEnvironment changed to update the execution policy for the current process only.
- Cleaned all common tests
- Added tests for PS Script Analyzer
- Cleaned TestHelper
- Removed Force parameter from Install-ModuleFromPowerShellGallery
- Added more test helper functions
- Cleaned MetaFixers and TestRunner
- Updated common test output format
- Fixed unicode and path bugs in tests
- Initial release
- Fixed unicode and path bugs in tests
- Initial release
- Consistency in encoding and indentations. Consistency is good by itself. But more important it allows us to:
- Avoid big diffs with cosmetic changes in Pull Requests.
Cosmetic changes (like formatting) make reviews harder.
If you want to include formatting changes (like replacing
"
by'
), please make it a separate commit. This will give reviewers an option to review meaningful changes separately from formatting changes.
By default git treats unicode files as binary files.
You may not notice it if your client (like VS or GitHub for Windows) takes care of such conversion.
History with Unicode files is hardly usable from command line git
.
> git diff
diff --git a/xActiveDirectory.psd1 b/xActiveDirectory.psd1
index 0fc1914..55fdb85 100644
Binary files a/xActiveDirectory.psd1 and b/xActiveDirectory.psd1 differ
With forced --text
option it would look like this:
> git diff --text
diff --git a/xActiveDirectory.psd1 b/xActiveDirectory.psd1
index 0fc1914..55fdb85 100644
--- a/xActiveDirectory.psd1
+++ b/xActiveDirectory.psd1
@@ -30,4 +30,4 @@
C m d l e t s T o E x p o r t = ' * '
}
-
\ No newline at end of file
+ # h e l l o
\ No newline at end of file
Command line git
version is a core component and should be used as a common denominator.
We are trying to provide automatic fixers where it's appropriate. A fixer corresponds to a particular test.
For example, if Files encoding
test from Meta.Tests.ps1 test fails, you should be able to run ConvertTo-UTF8
fixer from MetaFixers.psm1.
The test helper module (TestHelper.psm1) contains the following functions: New-Nuspec: Creates a new nuspec file for nuget package. Install-ResourceDesigner: Will attempt to download the xDSCResourceDesignerModule using Nuget package and return the module. Initialize-TestEnvironment: Initializes an environment for running unit or integration tests on a DSC resource. Restore-TestEnvironment: Restores the environment after running unit or integration tests on a DSC resource.
The Template files that are used for creating Unit and Integration tests for a DSC resource are available in the DSCResources GitHub Repository in the Tests.Template folder
To use these files, see the test guidelines document and the instructions at the top of each template file.
The resource files are: *Unit_Template.ps1**: Use to create a set of Unit Pester tests for a single DSC Resource. Integration_Template.ps1: Use to create a set of Integration Pester tests for a single DSC Resource. Integration_Config_Template.ps1: Use to create a DSC Configuration file for a single DSC Resource. Used in conjunction with Integration_Template.ps1.
To see examples of the Unit/Integration tests in practice, see the xNetworking MSFT_xFirewall resource: Unit Tests Integration Tests Resource DSC Configuration
To automatically download and install the DscResource.Tests in an AppVeyor.yml file, please see the following sample AppVeyor.yml. https://github.com/PowerShell/DscResources/blob/master/DscResource.Template/appveyor.yml