File tree 2 files changed +21
-2
lines changed 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,18 @@ protected override void ProcessRecord()
113
113
this . WriteObject ( formattedScriptDefinition ) ;
114
114
}
115
115
116
+ protected override void EndProcessing ( )
117
+ {
118
+ ScriptAnalyzer . Instance . CleanUp ( ) ;
119
+ base . EndProcessing ( ) ;
120
+ }
121
+
122
+ protected override void StopProcessing ( )
123
+ {
124
+ ScriptAnalyzer . Instance . CleanUp ( ) ;
125
+ base . StopProcessing ( ) ;
126
+ }
127
+
116
128
private void ValidateInputSettings ( )
117
129
{
118
130
// todo implement this
Original file line number Diff line number Diff line change @@ -3,6 +3,13 @@ $testRootDirectory = Split-Path -Parent $directory
3
3
Import-Module (Join-Path $testRootDirectory " PSScriptAnalyzerTestHelper.psm1" )
4
4
5
5
Describe " Invoke-Formatter Cmdlet" {
6
+ Context " Cmdlet cleans up and has no knock on effect" {
7
+ It " Invoke-Formatter has knock on effect on Invoke-ScriptAnalyzer" {
8
+ Invoke-Formatter ' foo'
9
+ Invoke-ScriptAnalyzer - ScriptDefinition ' gci' | Should -Not - BeNullOrEmpty
10
+ }
11
+ }
12
+
6
13
Context " When positional parameters are given" {
7
14
It " Should use the positional parameters" {
8
15
$def = @"
@@ -30,12 +37,12 @@ function foo {
30
37
}
31
38
32
39
It " Should not expand unary operators when being used as a single negative argument" {
33
- $script = ' $foo.bar(-$a)'
40
+ $script = ' $foo.bar(-$a)'
34
41
Invoke-Formatter ' $foo.bar(-$a)' - Settings CodeFormatting | Should - Be $script
35
42
}
36
43
37
44
It " Should expand unary operators when not being used as a single negative argument" {
38
- Invoke-Formatter ' $foo.bar(-$a+$b+$c)' - Settings CodeFormatting | Should - Be ' $foo.bar(-$a + $b + $c)'
45
+ Invoke-Formatter ' $foo.bar(-$a+$b+$c)' - Settings CodeFormatting | Should - Be ' $foo.bar(-$a + $b + $c)'
39
46
}
40
47
}
41
48
You can’t perform that action at this time.
0 commit comments