PowerShell / PowerShell/PSScriptAnalyzer

Question: How to manage module version in Pester tests for this module?

Open
#528 1 comment 0 reactions 1 assignee View on GitHub

@kapilmb is already working on this.

Since Aug 3, 2016.

Issue - Enhancement
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

I was dreaming up code to make sure that my Pester tests in the Tests\Engine folder are always testing the version of the module in which the directory resides. But, I noticed that the other .Tests.ps1 files in Tests\Engine just import the module by name w/o regard to version.

// From CorrectionExtent.Tests.ps1 & similar in RuleSuppressions.Tests.ps1
if (!(Get-Module PSScriptAnalyzer)) {Import-Module PSScriptAnalyzer}

This code just imports the first PSScriptAnalyzer instance found in the $env:PSModulePath directory order, which is typically the newest in $home. It might not be the version under test.

Is there some reason that these will work? I don't want to add extra code for no good reason.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.