Skip to content

Invoke-Formatter has knock on effect on subsequent call to Invoke-ScriptAnalyzer #1116

Closed

Description

Steps to reproduce

Using the latest state of the development branch (but also applies to RTM version of 1.17.1 and 1.16.1, therefore the bug has been present even before I joined the project).
I believe this bug is the main culprit of PSSA's tests sometimes becoming flaky and starting to fail sometimes when the test order changes.
cc James Truher (@JamesWTruher)

Describe "PSSA bug" {
	It "Invoke-ScriptAnalyzer works fine" {
		Invoke-ScriptAnalyzer -ScriptDefinition 'gci' | Should -Not -BeNullOrEmpty
	}

	It "Invoke-Formatter has knock on effect on Invoke-ScriptAnalyzer" {
		Invoke-Formatter 'foo'
		Invoke-ScriptAnalyzer -ScriptDefinition 'gci' | Should -Not -BeNullOrEmpty
	}

	It "Invoke-Formatter has knock on effect on Invoke-ScriptAnalyzer but it works the 2nd time" {
		Invoke-Formatter 'foo'
		Invoke-ScriptAnalyzer -ScriptDefinition 'gci'
		Invoke-ScriptAnalyzer -ScriptDefinition 'gci' | Should -Not -BeNullOrEmpty
	}
}

The 2nd test will fail, which is exposing the problem

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.17763.134
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.134
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.17.1

Activity

  1. changed the title [-]Invoke-Formatter has knock on effect on susequent call to Invoke-ScriptAnalyzer[/-] [+]Invoke-Formatter has knock on effect on subsequent call to Invoke-ScriptAnalyzer[/+] on Dec 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions