nohwnd / PowerShellGuard

A Guard implementation for PowerShell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build status

PowerShellGuard

A Guard implementation for PowerShell, which allows for Pester tests to automatically be run whenever you make changes to a file.

Why PowerShellGuard?

Streamlined workflow.

In conemu, I can dedicate a portion of my console window to just run tests. Using PowerShellGuard, I can watch my source code and trigger test runs of as much of my test harness as I want. This gives me fast feedback with minimal effort, making sure any changes that break existing behavior are noticed near when the changes are made.

Examples:

New-Guard -wait

Watch the files in the current directory for changes and run Pester on any changes.

New-Guard -Path .\lib\chef\knife\ -PathFilter '*.rb' -Recurse -TestCommand rspec -TestPath .\spec\unit\knife\
Wait-Guard

Watch all .rb files under .\lib\chef\knife and when they change, run the unit tests using RSpec.

dir *.ps1 | New-Guard -TestPath {"./Tests/$($_.basename).Tests.ps1"} -wait

Enumerate a directory and set up a test runner for each ps1 file based on its file name. For example hello.ps1 would have the test ./Tests/hello.Tests.ps1

Installing PowerShellGuard

You can install PowerShellGuard via PowerShellGet from the PowerShellGallery.

Install-Module PowerShellGuard

If you want the development feed (built from master),

Register-PSRepository -Name PowerShellGuard_current -SourceLocation 'https://ci.appveyor.com/nuget/PowerShellGuard/'
Install-Module PowerShellGuard -Source PowerShellGuard_current

Contributing

  • Source hosted at [GitHub][repo]
  • Report issues/questions/feature requests on [GitHub Issues][issues]

Pull requests are very welcome! Make sure your patches are well tested. Ideally create a topic branch for every separate change you make. For example:

  1. Fork the repo
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

A Guard implementation for PowerShell

License:MIT License


Languages

Language:PowerShell 100.0%