Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to exclude Example folders from tests #120

Open
ykuijs opened this issue Feb 18, 2022 · 1 comment
Open

Add ability to exclude Example folders from tests #120

ykuijs opened this issue Feb 18, 2022 · 1 comment
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.

Comments

@ykuijs
Copy link
Member

ykuijs commented Feb 18, 2022

It would be nice if there was an option to exclude certain Example files or folders from being checked for validity by the Examples test.

For SharePointDsc I have added an example, which also includes some additional, non-DSC scripts. The Examples test is now trying to run these as a DSC configuration, which of course fails. Would be great if I could exclude these files or the folder from this test.

@johlju johlju added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Mar 4, 2022
@johlju
Copy link
Member

johlju commented Mar 4, 2022

Actually, the v5 (Pester 5 version) does exclude files that are added to the build config, for example

  ExcludeSourceFile:
    - source/Examples

$exampleFiles = @(Get-ChildItem -Path $examplesPath -Filter '*.ps1' -Recurse | WhereSourceFileNotExcluded -ExcludeSourceFile $ExcludeSourceFile)

But that is missing for the Pester 4 tests:

$examples = Get-ChildItem -Path $examplesPath -Filter '*.ps1' -Recurse

But other Pester 4 tests are using it, like:

$textFiles += Get-TextFilesList -Root $SourcePath | WhereSourceFileNotExcluded

@ykuijs you could try adding that to the v4 test in you local copy and see if it works just adding that extra pipe in the code, and then adding the correct path to the build config.

@johlju johlju added bug The issue is a bug. and removed enhancement The issue is an enhancement request. labels Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

2 participants