diff --git a/spec/Edge.feature b/spec/Edge.feature deleted file mode 100644 index e7a3ded..0000000 --- a/spec/Edge.feature +++ /dev/null @@ -1,6 +0,0 @@ -Feature: implement Edge function - As a function author - In order to support - - Background: Edge exists - Given our function is named Edge diff --git a/spec/Export-PSGraph.feature b/spec/Export-PSGraph.feature deleted file mode 100644 index 264dc8c..0000000 --- a/spec/Export-PSGraph.feature +++ /dev/null @@ -1,6 +0,0 @@ -Feature: implement Export-PSGraph function - As a function author - In order to support - - Background: Export-PSGraph exists - Given our function is named Export-PSGraph diff --git a/spec/Graph.Steps.ps1 b/spec/Graph.Steps.ps1 deleted file mode 100644 index 91966f0..0000000 --- a/spec/Graph.Steps.ps1 +++ /dev/null @@ -1,55 +0,0 @@ -then " Graph unit tests will all pass" { - - it "Graph should not throw an error" { - - {Graph g {}} | Should Not Throw - } - - it "Graph attributes should not throw an error" { - - {Graph g -Attributes @{label = 'test'} {}} | Should Not Throw - } - - it "Graph positional attributes should not throw an error" { - - {Graph g @{label = 'test'} {}} | Should Not Throw - } - - it "Builds basic graph" { - - $name = 'GRAPH_NAME' - $result = (Graph $name {}) -join '' - - $result | Should Not BeNullOrEmpty - $result | Should match $name - $result | Should match '{' - $result | Should match '}' - $result | Should match 'digraph' - } -} - -Then "Graph feature tests will all pass" { - - It "Graph support attributes" { - - {graph g {} -Attributes @{label = "testcase"; style = 'filled'}} | Should Not Throw - - $resutls = (graph g {} -Attributes @{label = "testcase"; style = 'filled'}) -join '' - - $resutls | Should Match 'label=testcase;' - $resutls | Should Match 'style=filled;' - } - - It "Items can be placed in a graph" { - { - graph test { - node helo - edge hello world - rank same level - subgraph 0 { - - } - } - } | Should Not Throw - } -} \ No newline at end of file diff --git a/spec/Graph.feature b/spec/Graph.feature deleted file mode 100644 index d6097a9..0000000 --- a/spec/Graph.feature +++ /dev/null @@ -1,12 +0,0 @@ -Feature: implement Graph function - As a function author - In order to support - - Background: we have a module - Given the module was named PSGraph - and the module is imported - and our function was named Graph - - Scenario: Graph unit tests - Then Graph unit tests will all pass - And Graph feature tests will all pass diff --git a/spec/Inline.feature b/spec/Inline.feature deleted file mode 100644 index 9bf1555..0000000 --- a/spec/Inline.feature +++ /dev/null @@ -1,6 +0,0 @@ -Feature: implement Inline function - As a function author - In order to support - - Background: Inline exists - Given our function is named Inline diff --git a/spec/Install-GraphViz.feature b/spec/Install-GraphViz.feature deleted file mode 100644 index 34ee917..0000000 --- a/spec/Install-GraphViz.feature +++ /dev/null @@ -1,6 +0,0 @@ -Feature: implement Install-GraphViz function - As a function author - In order to support - - Background: Install-GraphViz exists - Given our function is named Install-GraphViz diff --git a/spec/Node.feature b/spec/Node.feature deleted file mode 100644 index f519a05..0000000 --- a/spec/Node.feature +++ /dev/null @@ -1,6 +0,0 @@ -Feature: implement Node function - As a function author - In order to support - - Background: Node exists - Given our function is named Node diff --git a/spec/Rank.feature b/spec/Rank.feature deleted file mode 100644 index 77cdce8..0000000 --- a/spec/Rank.feature +++ /dev/null @@ -1,6 +0,0 @@ -Feature: implement Rank function - As a function author - In order to support - - Background: Rank exists - Given our function is named Rank diff --git a/spec/Set-NodeFormatScript.feature b/spec/Set-NodeFormatScript.feature deleted file mode 100644 index 9de76b6..0000000 --- a/spec/Set-NodeFormatScript.feature +++ /dev/null @@ -1,6 +0,0 @@ -Feature: implement Set-NodeFormatScript function - As a function author - In order to support - - Background: Set-NodeFormatScript exists - Given our function is named Set-NodeFormatScript diff --git a/spec/SubGraph.feature b/spec/SubGraph.feature deleted file mode 100644 index caec6d7..0000000 --- a/spec/SubGraph.feature +++ /dev/null @@ -1,6 +0,0 @@ -Feature: implement SubGraph function - As a function author - In order to support - - Background: SubGraph exists - Given our function is named SubGraph diff --git a/spec/function.Steps.ps1 b/spec/function.Steps.ps1 deleted file mode 100644 index dac5453..0000000 --- a/spec/function.Steps.ps1 +++ /dev/null @@ -1,6 +0,0 @@ -Given 'our function is named (?>*)' { - param($Function) - - $script:Function = Get-Command -Name $Function -Module $ModuleName - $script:Function | Should Not BeNullOrEmpty -} diff --git a/spec/module.Steps.ps1 b/spec/module.Steps.ps1 deleted file mode 100644 index df3a045..0000000 --- a/spec/module.Steps.ps1 +++ /dev/null @@ -1,138 +0,0 @@ -Given 'the module was named (\S*)' { - Param($Name) - $Script:ModuleName = $Name - - $path = "$PSScriptRoot\.." - $module = Get-ChildItem -Path $path -Recurse -Filter "$ModuleName.psm1" -verbose - $module | should not benullorempty - $module.fullname | Should Exist - - $Script:ModuleSource = "$PSScriptRoot\..\$ModuleName" - $Script:ModuleOutput = "$PSScriptRoot\..\Output\$ModuleName" -} - -Given 'we use the (\S*) root folder' { - Param($root) - Switch ($root) - { - 'Project' - { - $script:BaseFolder = Resolve-Path "$PSScriptRoot\.." | Select -ExpandProperty Path - } - 'ModuleSource' - { - $script:BaseFolder = $Script:ModuleSource - } - 'ModuleOutput' - { - $script:BaseFolder = $Script:ModuleOutput - } - } -} - -Then 'it (will have|had) a (?\S*) (file|folder).*' { - Param($Path) - - Join-Path $script:BaseFolder $Path | Should Exist -} - -When 'the module (is|can be) imported' { - { Import-Module $ModuleOutput -Force } | Should Not Throw -} - -Then 'Get-Module will show the module' { - Get-Module -Name $ModuleName | Should Not BeNullOrEmpty -} - -Then 'Get-Command will list functions' { - Get-Command -Module $ModuleName | Should Not BeNullOrEmpty -} - -Then '(function )?(?\S*) will be listed in module manifest' { - Param($Function) - (Get-Content $ModuleSource\$ModuleName.psd1 -Raw) -match [regex]::Escape($Function) | Should Be $true -} - -Then '(function )?(?\S*) will contain (?.*)' { - Param($Function, $Text) - $Command = Get-Command $Function -Module $ModuleName - $match = [regex]::Escape($Text) - ($Command.Definition -match $match ) | Should Be True -} - -Then '(function )?(?\S*) will have comment based help' { - Param($Function) - $help = Get-Help $Function - $help | Should Not BeNullOrEmpty -} - -Then 'will have readthedoc pages' { - { Invoke-Webrequest -uri "https://$ModuleName.readthedocs.io" -UseBasicParsing } | Should Not Throw -} - -Then '(function )?(?\S*) will have a feature specification or a pester test' { - param($Function) - - $file = Get-ChildItem -Path $PSScriptRoot\.. -Include "$Function.feature", "$Function.Tests.ps1" -Recurse - $file.fullname | Should Not BeNullOrEmpty -} - -Then 'all public functions (?.*)' { - Param($Action) - $step = @{keyword = 'Then'} - $AllPassed = $true - foreach ($command in (Get-Command -Module $ModuleName )) - { - $step.text = ('function {0} {1}' -f $command.Name, $Action ) - - Invoke-GherkinStep $step -Pester $Pester -Visible - If ( -Not $Pester.TestResult[-1].Passed ) - { - $AllPassed = $false - } - - $step.keyword = 'And' - } - $AllPassed | Should be $true -} - -Then 'will be listed in the PSGallery' { - Find-Module $ModuleName | Should Not BeNullOrEmpty -} - -Given 'we have (?(public)) functions?' { - param($folder) - "$psscriptroot\..\psgraph\$folder\*.ps1" | Should Exist -} - -Then 'all script files pass PSScriptAnalyzer rules' { - - $Rules = Get-ScriptAnalyzerRule - $scripts = Get-ChildItem $BaseFolder -Include *.ps1, *.psm1, *.psd1 -Recurse | where fullname -notmatch 'classes' - - $AllPassed = $true - - foreach ($Script in $scripts ) - { - $file = $script.fullname.Replace($BaseFolder, '$') - - - context $file { - - foreach ( $rule in $rules ) - { - It " [$file] Rule [$rule]" { - - (Invoke-ScriptAnalyzer -Path $script.FullName -IncludeRule $rule.RuleName ).Count | Should Be 0 - } - } - } - - If ( -Not $Pester.TestResult[-1].Passed ) - { - $AllPassed = $false - } - } - - $AllPassed | Should be $true -} diff --git a/spec/module.feature b/spec/module.feature deleted file mode 100644 index d21f5b9..0000000 --- a/spec/module.feature +++ /dev/null @@ -1,75 +0,0 @@ -Feature: A proper community module - As a module owner - In order to have a good community module - I want to make sure everything works and the quality is high - -Background: we have a module - Given the module was named PSGraph - - -Scenario: Should have correct project structure and files - Given we use the project root folder - Then it will have a readme.md file for general information - And it will have a LICENSE file - And it will have a tests\*.Tests.ps1 file for Pester - And it will have a spec\*.feature file for Gherkin - And it will have a spec\*.Steps.ps1 file for Gherkin - And it will have a build.ps1 file for builds - And it will have a psake.ps1 file for builds - And it will have a appveyor.yml file for build automation - - -Scenario: Should have correct module structure in source - Given we use the ModuleSource root folder - Then it will have a *.psd1 file for module manifest - And it will have a *.psm1 file for module - And it will have a public folder for public functions - And it will have a public\*.ps1 file for a public function - -Scenario: Should have correct module structure in source - Given we use the ModuleOutput root folder - Then it will have a *.psd1 file for module manifest - And it will have a *.psm1 file for module - -Scenario: the module source should import - Given we use the ModuleSource root folder - And it had a *.psd1 file - When the module is imported - Then Get-Module will show the module - And Get-Command will list functions - -Scenario: The built Module should import - Given we use the ModuleOutput root folder - And it had a *.psd1 file - When the module is imported - Then Get-Module will show the module - And Get-Command will list functions - -Scenario: Public function features - Given the module is imported - And we have public functions - Then all public functions will be listed in module manifest - And all public functions will contain cmdletbinding - And all public functions will contain ThrowTerminatingError - -Scenario: Should be well documented - Given the module is imported - And we use the project root folder - And we have public functions - Then it will have a readme.md file for general information - And all public functions will have comment based help - And function Node will have a feature specification or a pester test - And all public functions will have a feature specification or a pester test - And will have readthedoc pages - And it will have a PITCHME.md file for project promotion - -@PSScriptAnalyzer @Slow -Scenario: Should pass PSScriptAnalyzer rules - Given we use the module root folder - Then it will have a public\*.ps1 file for a public function - And all script files pass PSScriptAnalyzer rules - -@Slow -Scenario: Should be published - Given the module can be imported - Then will be listed in the PSGallery