Skip to content

Commit 31ab8d5

Browse files
committed
Remove extraneous import-module commands
The expectation is that these tests are run as part of the test harness, the re-importing of the module is unneeded
1 parent 1a8d285 commit 31ab8d5

File tree

65 files changed

+73
-184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+73
-184
lines changed

Tests/Engine/CorrectionExtent.tests.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
Import-Module PSScriptAnalyzer
2-
31
Describe "Correction Extent" {
42
$type = [Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.CorrectionExtent]
53

Tests/Engine/CustomizedRule.tests.ps1

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
2-
# Check if PSScriptAnalyzer is already loaded so we don't
3-
# overwrite a test version of Invoke-ScriptAnalyzer by
4-
# accident
5-
if (!(Get-Module PSScriptAnalyzer) -and !$testingLibraryUsage)
6-
{
7-
Import-Module PSScriptAnalyzer
8-
}
9-
10-
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
1+
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
112
$testRootDirectory = Split-Path -Parent $directory
123
Import-Module (Join-Path $testRootDirectory 'PSScriptAnalyzerTestHelper.psm1')
134

Tests/Engine/EditableText.tests.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
22
$testRootDirectory = Split-Path -Parent $directory
33

4-
Import-Module PSScriptAnalyzer
54
Import-Module (Join-Path $testRootDirectory "PSScriptAnalyzerTestHelper.psm1")
65

76
$editableTextType = "Microsoft.Windows.PowerShell.ScriptAnalyzer.EditableText"

Tests/Engine/Extensions.tests.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
22
$testRootDirectory = Split-Path -Parent $directory
3-
4-
Import-Module PSScriptAnalyzer
53
Import-Module (Join-Path $testRootDirectory "PSScriptAnalyzerTestHelper.psm1")
64

75
function Get-Extent {

Tests/Engine/GetScriptAnalyzerRule.tests.ps1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
21
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
3-
Import-Module -Verbose PSScriptAnalyzer
42
$testRootDirectory = Split-Path -Parent $directory
53
Import-Module (Join-Path $testRootDirectory 'PSScriptAnalyzerTestHelper.psm1')
64
$sa = Get-Command Get-ScriptAnalyzerRule
@@ -175,7 +173,7 @@ Describe "TestWildCard" {
175173
}
176174

177175
It "filters rules based on wild card input and severity"{
178-
$rules = Get-ScriptAnalyzerRule -Name PSDSC* -Severity Information
176+
$rules = Get-ScriptAnalyzerRule -Name PSDSC* -Severity Information
179177
$rules.Count | Should -Be 4
180178
}
181179
}

Tests/Engine/Helper.tests.ps1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
Import-Module PSScriptAnalyzer
2-
31
Describe "Test Directed Graph" {
42
Context "When a graph is created" {
53
$digraph = New-Object -TypeName 'Microsoft.Windows.PowerShell.ScriptAnalyzer.DiGraph[string]'
@@ -28,4 +26,4 @@ Describe "Test Directed Graph" {
2826
$digraph.IsConnected('v1', 'v4') | Should -BeTrue
2927
}
3028
}
31-
}
29+
}

Tests/Engine/InvokeFormatter.tests.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
22
$testRootDirectory = Split-Path -Parent $directory
3-
4-
Import-Module PSScriptAnalyzer
53
Import-Module (Join-Path $testRootDirectory "PSScriptAnalyzerTestHelper.psm1")
64

75
Describe "Invoke-Formatter Cmdlet" {

Tests/Engine/InvokeScriptAnalyzer.tests.ps1

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
# Check if PSScriptAnalyzer is already loaded so we don't
2-
# overwrite a test version of Invoke-ScriptAnalyzer by
3-
# accident
4-
if (!(Get-Module PSScriptAnalyzer) -and !$testingLibraryUsage)
5-
{
6-
Import-Module PSScriptAnalyzer
7-
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
8-
$testRootDirectory = Split-Path -Parent $directory
9-
Import-Module (Join-Path $testRootDirectory 'PSScriptAnalyzerTestHelper.psm1')
10-
}
11-
12-
$sa = Get-Command Invoke-ScriptAnalyzer
1+
$sa = Get-Command Invoke-ScriptAnalyzer
132
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
143
$singularNouns = "PSUseSingularNouns"
154
$approvedVerb = "PSUseApprovedVerbs"

Tests/Engine/LibraryUsage.tests.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
22
$testRootDirectory = Split-Path -Parent $directory
33
Import-Module (Join-Path $testRootDirectory 'PSScriptAnalyzerTestHelper.psm1')
4-
Import-Module PSScriptAnalyzer
54

6-
# test is meant to verify functionality if chsarp apis are used. Hence not if psedition is CoreCLR
5+
# test is meant to verify functionality if csharp apis are used. Hence not if psedition is CoreCLR
76
if ((Test-PSEditionCoreCLR))
87
{
98
return

Tests/Engine/RuleSuppression.tests.ps1

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
# Check if PSScriptAnalyzer is already loaded so we don't
2-
# overwrite a test version of Invoke-ScriptAnalyzer by
3-
# accident
4-
if (!(Get-Module PSScriptAnalyzer) -and !$testingLibraryUsage)
5-
{
6-
Import-Module -Verbose PSScriptAnalyzer
7-
}
8-
9-
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
1+
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
102
$testRootDirectory = Split-Path -Parent $directory
113
Import-Module (Join-Path $testRootDirectory 'PSScriptAnalyzerTestHelper.psm1')
124

0 commit comments

Comments
 (0)