Skip to content

Commit bdef9c7

Browse files
committed
Remove -Debug from tests
It causes failures in NonInteractive mode
1 parent c636e90 commit bdef9c7

1 file changed

Lines changed: 3 additions & 36 deletions

File tree

Tests/Private/ConvertToAst.Tests.ps1

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Describe "ConvertToAst" {
33

44
Context "It returns a ParseResult for file paths" {
55
$ParseResult = InModuleScope ModuleBuilder {
6-
ConvertToAst $PSCommandPath -Debug
6+
ConvertToAst $PSCommandPath
77
}
88

99
It "Returns a ParseResult object" {
@@ -23,7 +23,7 @@ Describe "ConvertToAst" {
2323

2424
Context "It parses piped in commands" {
2525
$ParseResult = InModuleScope ModuleBuilder {
26-
Get-Command ConvertToAst | ConvertToAst -Debug
26+
Get-Command ConvertToAst | ConvertToAst
2727
}
2828

2929
It "Returns a ParseResult object with the AST" {
@@ -34,45 +34,12 @@ Describe "ConvertToAst" {
3434

3535
Context "It parses piped in modules" {
3636
$ParseResult = InModuleScope ModuleBuilder {
37-
Get-Module ModuleBuilder | ConvertToAst -Debug
37+
Get-Module ModuleBuilder | ConvertToAst
3838
}
3939

4040
It "Returns a ParseResult object with the AST" {
4141
$ParseResult.PSTypeNames[0] | Should -Match .*\.ParseResult
4242
$ParseResult.AST | Should -BeOfType [System.Management.Automation.Language.Ast]
4343
}
4444
}
45-
46-
<#
47-
param(
48-
# The script content, or script or module file path to parse
49-
[Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
50-
[Alias("Path", "PSPath", "Definition", "ScriptBlock", "Module")]
51-
$Code
52-
)
53-
process {
54-
Write-Debug " ENTER: ConvertToAst $Code"
55-
$ParseErrors = $null
56-
$Tokens = $null
57-
if ($Code | Test-Path -ErrorAction SilentlyContinue) {
58-
Write-Debug " Parse Code as Path"
59-
$AST = [System.Management.Automation.Language.Parser]::ParseFile(($Code | Convert-Path), [ref]$Tokens, [ref]$ParseErrors)
60-
} elseif ($Code -is [System.Management.Automation.FunctionInfo]) {
61-
Write-Debug " Parse Code as Function"
62-
$String = "function $($Code.Name) { $($Code.Definition) }"
63-
$AST = [System.Management.Automation.Language.Parser]::ParseInput($String, [ref]$Tokens, [ref]$ParseErrors)
64-
} else {
65-
Write-Debug " Parse Code as String"
66-
$AST = [System.Management.Automation.Language.Parser]::ParseInput([String]$Code, [ref]$Tokens, [ref]$ParseErrors)
67-
}
68-
69-
Write-Debug " EXIT: ConvertToAst"
70-
[PSCustomObject]@{
71-
PSTypeName = "PoshCode.ModuleBuilder.ParseResults"
72-
ParseErrors = $ParseErrors
73-
Tokens = $Tokens
74-
AST = $AST
75-
}
76-
}
77-
#>
7845
}

0 commit comments

Comments
 (0)