PowerShell / DscResource.Tests

Common meta tests for PowerShell DSC resources repositories.
MIT License
51 stars 49 forks source link

Test-PublishMetadata: Exception Raised If the Example being tested has an invalid GUID #330

Closed X-Guardian closed 5 years ago

X-Guardian commented 5 years ago

Details of the problem, bug, or enhancement

If Test-PublishMetadata is run against a DSC example that contains file metadata with an invalid GUID, an exception is thrown.

Example: PowerShell/xActiveDirectory#409

Verbose logs showing the problem (if applicable)

Test-PublishMetadata -Path invalid_example_config.ps1
InvalidGuid,Test-ScriptFileInfo
At \DscResource.Tests\DscResource.GalleryDeploy\DscResource.GalleryDeploy.psm1:302 char:17
+                 throw $_
+                 ~~~~~~~~
    + CategoryInfo          : OperationStopped: (InvalidGuid,Test-ScriptFileInfo:String) [], RuntimeException
    + FullyQualifiedErrorId : InvalidGuid,Test-ScriptFileInfo

Suggested solution to the issue

Add processing for this error to the Test-PublishMetdadata function so that only a warning is shown, and improve the unknown error throw by outputting the file details as well as the error.