This improves the performance of the listener by not relying on a new
process starting up to run the listener. It improves the debugability
of tests by providing more direct access to the session executing
the listener. It also reverses the blocking nature of starting the
listener. By default, Start-HttpListener will no longer block, you need
to use -Foreground to have Start-HttpListener block. Lastly, create
a way to catch errors if the listener has a problem. If code in the
listener throws, it emits an error record.
Fixed tests that were failing or throwing unnecessary information on-screen.
Updated the paths to powershell.exe as per the new artifact layout.
Added Publish-PSTestTools to Compress-TestContent
Added PS Test tools to PSModulePath before starting tests.
Added try/catch within the enumeration loop to allow the enumeration to continue after encountering an error such as an item within the directory being deleted or renamed.
To assist in testing, two new internal test hooks have been added which cause Get-ChildItem to either delete or rename a specific file (file name hard-coded) when encountered during enumeration.
* Fixing ConvertFrom-Json on CoreCLR to be able to handle a collection of strings which represent a JSON content.
* Adding test case for ConvertFrom-Json to process an array of PSObjects as a single string.
* Support Link Header pagination in WebCmdlets to make it easier for the end user implementing:
https://github.com/PowerShell/PowerShell-RFC/blob/master/2-Draft-Accepted/RFC0021-Link-header-based-pagination-for-WebCmdlets.md
When the response includes a Link Header (https://tools.ietf.org/html/rfc5988#page-6), for Invoke-WebRequest we
create a RelationLink property that is a Dictionary representing the URLs and rel attributes and ensure the
URLs are absolute to make it easier for the developer to use. For Invoke-RestMethod, we expose a -FollowRelLink
switch to automatically follow 'next' rel links to the end until we hit the optional -MaxRelLink parameter value.
* removed unnecessary refs to namespaces
* addressed code review feedback
Use the method NativeCommandParameterBinder.NeedQuotes, which is used by powershell native command processor, to check if quotes are needed. If yes, add quotes in the same way as our native command processor.
Also, make 'Invoke-Item' on Linux and OSX able to invoke an executable properly.
Make changes to not expose the aliases "gin", "gsv", "sasv" and "spsv" in Unix platforms.
Also refactored aliases related tests and added new tests covering the complete list of built-in aliases/cmdlets.
The code paths deleted where using the undocumented Win32 APIs on WIn8 and newer for the following purposes:
* Faster filtering
* Getting two properties (left empty on Win7 and below)
* Logging using Certificate components when a cert is deleted or copied.
After the change, all the code uses public APIs. Filtering is done in PowerShell using existing code. I don't believe the logging is needed.
Implements support for backgrounding pipelines with &. Putting & at the end of a pipeline will cause the pipeline
to be run as a PowerShell job. When a pipeline is backgrounded a job object is returned. Once the pipeline is
running as a job, all of the normal job cmdlets can be used to manage the job. Variables (ignoring process-specific
variables) used in the pipeline are automatically copied to the job so
copy $foo $bar &
just works. The job is also run in the current directory instead of the user's home directory as is the case with Start-Job.Implement
* Add autoload for TestHelpers.psm1
Test.Helpers.psm1 was renamed to TestHelpers.psm1
* Resolve conflit and rebase Add autoload for TestLanguage.psm1
* Remove unneeded comments from PSD1 files
* Rename test modules
Remove approved verbs (Get-Verb) from module names.
* Enhance ShouldBeErrorId to output exception into pipeline for later analysis
* Remove unneeded comments
* Resolve merge conflict
The appropriate [SemanticVersion] constructor now accepts a [version] instance that has only major and minor components specified, in which case the patch component now defaults to 0.
Brings the Get-ChildItem more in line with the Unix ls -r and the Windows DIR /S native commands. Like these commands, the cmdlet will display symbolic links to directories found during recursion but will not recurse into them.
Like the Unix ls command---and unlike the Windows DIR /S command--- the cmdlet will recurse into symlinks given on the command line.
`$psversiontable.psversion -gt "3.0"` which is used by PowerShellGet to determine if a module is compatible with the current version of PowerShell.
Change is to allow specifying only major or major+minor where the missing segments default to zero by providing overloaded constructors and allow
the string parsing method to not require major, minor, and patch segments to all be specified (only major is required).
Based on the [response](https://github.com/mojombo/semver/issues/368) from the maintainer of semver, there is no requirement to have strict
conformance for the inputs to the constructor and allowing "3.0" to result in a semver of 3.0.0 is reasonable.
when automating test execution, some environments don't have a tty which causes
the tests to fail. df is just as good a test as stty as it is also guaranteed to be
present. This change also allows the tests to be run on OSX
* Fix Rename-Item to allow Unix globbing patterns in -Literal paths (#2799)
In the process of normalizing a relative path, PowerShell checks to see
see if the path exists, which it does by invoking
Directory.EnumerateFiles(directory, filename);
On Unix platforms, if the filename contains globbing patterns, such as [ab],
EnumerateFiles (and EnumerateDirectories) will perform the globbing. Using
globbing patterns, a file named 'file[txt].txt' is reported as not existing.
This fix changes the file-existence test on Unix to use a native function
instead of either of the Directory.EnumerateXXX functions.
* Fix for AppVeyor failure
* Changes per code review, and a couple of letter-casing changes.
This change enables globbing (wildcard expansion) against the file system for native commands like '/bin/ls'. The expansion is only done in the file system. In non-filesystem drives expansion is not done and the pattern is returned unchanged.
Limitations of the fix:
Currently quoting is not honored so for a command like /bin/ls "*.txt", wildcard expansion will still be done. Adding support for bare word detection will come in a future PR. Use --% to suppress wildcard expansion e.g. git add --% *
This fixes issue #2607.
'RequiredModules' is a field in module manifest that can reference other modules using ModuleSpecification format.
The basic version of this format (just module name) was working fine, however, there was a problem when a more detailed version of the format was used (the one that uses module versions or/and GUIDs).
During module import, there is a check for cyclic references through 'RequiredModules' field. The bug was in this check for cyclic references, related to comparison rules for ModuleSpecification objects - as a result, the code was incorrectly reporting 'cyclic reference' error in cases when there was none.
Also, added tests for different ModuleSpecification formats and a test for error when there is actually a cyclic reference.
When 'Remove-Item' is used to remove a symbolic link in Windows, only the link itself is removed. The '-Force' switch is no longer required.
If the directory pointed to by the link has child items, the cmdlet no longer prompts the user to remove the child items---those child items are not removed. The '-Recurse' switch, if given, is ignored.
This brings 'Remove-Item' more in line with the behavior of the 'rm' command on Unix.
* fixes summary block typo
* Adds support for Port parameter for SSH PSSessions
* Reverted back to master, modified based on PR feedback
* Update exception message
* remove unused line
* Add existing constructor back in as to not break public contract
* remove port check
* pass nested inner exception straight to Should
* dispose runspace after each test
* Add SSHHostParameterSet attribute for Invoke-Command Port property
* Update ParseSSHConnectionHashTable method to accept Port value as integer
* Add helper method for validating port in range. Refactor port parameter constructor overload to use original constructor
* rename method
* Adds GetSSHConnectionStringParameter and GetSSHConnectionIntParameter methods for retrieving SSHConnection hashtable values
* Adds method comments
* Adds helper method comment
* Change methods to add C# 7 patterns
string. If the string was a uri with spaces, ToString() doesn't return the escaped version. The AbsoluteUri property
should be used instead which returns an escaped absolute uri (if valid).
Also renamed TestModuleManfest.ps1 to TestModuleManifest.Tests.ps1 so that it gets picked up correctly as Pester test.
Since HelpInfoUri is just a string, ensure it is a valid absolute uri and escaped correctly whereas before it was just
an opaque string that wasn't validated.
Rather than relying on case-insensitive string compares of source and destination paths, use operating system calls to determine whether two paths refer to the same file. This solves not only the case-insensitivity issue but also allows the cmdlet to operate properly if the destination is a hard or symbolic link to the source.
The Windows side is implemented in C#. The Unix side is implemented partially in native code.
This makes it possibe to write for example
[ValidatePattern('[A-Z]:', ErrorMessage='The Drive should be specified as a single letter followed by a colon, for example "D:"')]
[string] $Drive,
The element being validated is also passed, so {0} can be used in the custom error message