Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

In AppVeyor.psm1 there should be an option to change how we detect the files that need code coverage #114

Closed
TravisEz13 opened this issue Feb 11, 2017 · 3 comments
Labels
enhancement The issue is an enhancement request.

Comments

@TravisEz13
Copy link
Member

TravisEz13 commented Feb 11, 2017

The task to do this in #88 was added because I was going to write the code to do the detection of the files that needed code coverage. Since this was community provided. Let's assume it's sufficient. I'm filing thing just to keep the idea in mind and open it to a discussion.

@johlju johlju added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Apr 23, 2018
@johlju
Copy link
Contributor

johlju commented Aug 3, 2018

This does not affect resource modules, like SharePointDsc, that uses the Harness-model. Those resource modules control the code coverage them self by having all testing logic in the harness function in the individual repo. Below is improving functionality for the default shared model.

Currently it catches all module files (*.psm1) recursively in the folders added here.

$possibleModulePaths = @(
'DSCResources',
'DSCClassResources'
)

And as a workaround for resource modules that (wrongly) has helper modules in the root folder this is added as well

$codeCoveragePaths = @(
"$env:APPVEYOR_BUILD_FOLDER\*.psm1"
)

We should instead add a Modules folder to the list above, should be located in the root as well. In the Modules folder a resource module helper modules can be located (as .psm1). This should be updated in the DscResource.Template as well.

We could add the $possibleModulePath as a parameter instead so it's easier to control the module paths if they change in the future, with the following as default values.

$possibleModulePaths = @( 
     'DSCResources', 
     'DSCClassResources',
     'Modules'
 ) 

@johlju
Copy link
Contributor

johlju commented Aug 3, 2018

@PlagueHO This would help with the code coverage in for example CertificateDsc? To find if there are parts of the modules that are not covered by tests?

johlju added a commit to johlju/DscResource.Tests that referenced this issue Aug 3, 2018
- Add a new parameter `-CoverageModulePath` in the function
  `Invoke-AppveyorTestScriptTask` to be able to add one or more relative
  paths for which will be evaluated for PowerShell modules files (.psm1)
  (issue PowerShell#114).
@johlju
Copy link
Contributor

johlju commented Aug 3, 2018

Did a test of this with CertificateDsc, and it seems it the helper function are covered. The code coverage percentage dropped, which is positive.
https://ci.appveyor.com/project/johlju/certificatedsc/build/2.3.6.0#L1486

johlju added a commit to johlju/DscResource.Tests that referenced this issue Aug 7, 2018
- Add a new parameter `-CoverageModulePath` in the function
  `Invoke-AppveyorTestScriptTask` to be able to add one or more relative
  paths for which will be evaluated for PowerShell modules files (.psm1)
  (issue PowerShell#114).
johlju added a commit to johlju/DscResource.Tests that referenced this issue Aug 11, 2018
- Add a new parameter `-CoverageModulePath` in the function
  `Invoke-AppveyorTestScriptTask` to be able to add one or more relative
  paths for which will be evaluated for PowerShell modules files (.psm1)
  (issue PowerShell#114).
johlju added a commit to johlju/DscResource.Tests that referenced this issue Aug 13, 2018
- Add a new parameter `-CoverageModulePath` in the function
  `Invoke-AppveyorTestScriptTask` to be able to add one or more relative
  paths for which will be evaluated for PowerShell modules files (.psm1)
  (issue PowerShell#114).
johlju added a commit to johlju/DscResource.Tests that referenced this issue Aug 15, 2018
- Add a new parameter `-CoverageModulePath` in the function
  `Invoke-AppveyorTestScriptTask` to be able to add one or more relative
  paths for which will be evaluated for PowerShell modules files (.psm1)
  (issue PowerShell#114).
johlju added a commit that referenced this issue Aug 15, 2018
- Add a new parameter `-CodeCoveragePath` in the function
  `Invoke-AppveyorTestScriptTask` to be able to add one or more relative
  paths which will be searched for PowerShell modules files (.psm1) to be used
  for evaluating code coverage (issue #114).
- The Modules folder, in the resource module root path, was added as a
  default path to be searched for PowerShell modules files (.psm1) to be
  used for evaluating code coverage.
@johlju johlju removed the help wanted The issue is up for grabs for anyone in the community. label Aug 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement The issue is an enhancement request.
Projects
None yet
Development

No branches or pull requests

2 participants