Commit graph

1263 commits

Author SHA1 Message Date
Chunqing Chen 40eb3b3e13 Get-ChildItem <PATH>/* -file should include <Path> as search directory (#5431)
* get-childitem <PATH>/* -file should include <Path> as search directory

* [Feature] Added check for -Directory and more tests

* [Feature] Added check for the dynamic parameter type
2018-02-07 16:30:14 -08:00
Takuya Shibata 22014a923a Use 'RequireAdminOnWindows' tag in Set-Date tests (#6034)
* Use 'RequireAdminOnWindows' tag instead of 'Test-IsElevated' function.

* Fix incorrect condition of user privilege in Linux/macOS CI
2018-02-06 09:31:30 -08:00
James Truher [MSFT] 99a7d38cae Update test framework and tests to support 4x version of Pester (#6064)
* Test fixes and changes needed to support Pester 4.0.8

* Replace 'Should Contain' with new 'Should FileContentMatch' assertion

Explicitly check for string creation with write-output

* Use the current version of pester and install it in modulesDir

* Simplify logic for relative path test.

Multiple '..' is not needed for a relative path, a single one will do. Also, on multi-drive systems using split-path -noqualifier will probably do the wrong thing with regard to constructing a correct path.
Remove extraneous Should Not Throw test, if this throws, the test will fail, we don't need to explicitly assert the not throw

* In some environments it is possible that computer name is 'localhost', so that should be allowed

* [feature] Add link for migrating tests from Pester v3 to v4

Fix up capitalization and white space issues
Change one test to check FullyQualifiedErrorId rather than just `Should Throw`

* [feature] update invoke-item test to handle the case where multiple notepad processes are running

* Fix spelling issue with Pester 4x, calling it Pester 4 should be sufficient
2018-02-05 11:58:25 -08:00
Mark Kraus 37780de9b7 [Feature] Remove -TimeOutSec from non timeout related tests (#6055)
The timeout mechanism should be supported by the test framework (Pester here).
2018-02-02 23:56:06 +04:00
Ilya ca4e4798fb Remove unsupported members from the enum 'Language' in Add-Type (#5829)
[breaking change]
Remove the unsupported members (various versions of CSharp and `JScript`) from the enum 'Language' in Add-Type. After this change, `Add-Type -Language` only supports `CSharp` and `VisualBasic`.
2018-02-01 09:25:20 -08:00
Mark Kraus 7d003f4f67 Change Web Cmdlet Tests to Use 127.0.0.1 not Localhost (#6069)
Change Web Cmdlets Tests to Use 127.0.0.1 instead of localhost due to dotnet/corefx#24104
This provides a decent speed boost to the WebCmdlet tests (Faster in dozens of times).
2018-02-01 08:26:05 +04:00
Mark Kraus 47c4a0a74b Test: Add Verbosity and more accurate timeout implementation for Start-WebListener (#6013)
- Add verbosity to the WebListener when it fails to assist in troubleshooting
- Switch the WebListener initialization timeout to count cycles instead of using fixed dates to work around possible VM CI sleep/ issues.
2018-01-31 14:55:16 -08:00
Travis Plunk bd865280f3
update processes to allow for coordinated vulnerability disclosure (#6042) 2018-01-27 10:28:33 -08:00
Travis Plunk 3a33be87a7 Merge branch '6.0.1' into master
# Conflicts:
#	docker/release/fedora27/Dockerfile
#	docs/installation/linux.md
#	docs/installation/macos.md
#	tools/metadata.json
2018-01-25 16:35:25 -08:00
Dongbo Wang 875a12d3d1 Skip tests that use ExecutionPolicy cmdlets on Unix (#6021) 2018-01-25 11:18:21 -08:00
Dan Travison 43662809c7 Add '-settingsfile' to 'pwsh' to support loading a custom powershell config file. (#5920)
Support loading a custom `powershell.config.json` file via the command-line for use in testing.
This change supports replacing the default `powershell.config.json` file that's usually loaded from the `PSHome` directory with a custom version file.

The primary use-cases for this command-line option are as follows:
1. Allow the CI system to disable settings that impact test run times; such as disabling syslog usage on Linux and MacOS
2. Support testing of syslog and os_log without interfering with normal PowerShell operations during test runs via launching an instance with custom log settings.
2018-01-24 22:12:14 -08:00
Mark Kraus a36d58cf09 Add Simplified multipart/form-data Support to Web Cmdlets Through -Form Parameter (#5972)
- Adds -Form Parameter to Invoke-WebRequest and Invoke-RestMethod.
- Form Accepts any IDictionary.
- Keys are used as multipart/form-data field names (PSObject unwrapped and ConvertTo<String>(Object)).
- FileInfo values are added as StreamContent with application/octet-stream content type and the FileInfo.Name as the file name.
- Strings are treated as StringContent.
- Singe values are converted to string with ConvertTo<String>(Object) and treated as StringContent
- Top level collections are enumerated and converted as above. Nested collections are treated as a single value and converted accordingly.
- Form is mutually exclusive with -Body and -InFile.
- Per PowerShell-Committee decision, -Form makes no assumptions about the HTTP method used. It can theoretically be used with any method. User will need to manually supply -Method POST to post the form.
- ContentType and content related headers supplied to -Headers will be ignored/cleared as MultipartFormDataContent requires control of these headers.
2018-01-25 09:17:55 +04:00
Takuya Shibata f86371e347 Change Microsoft.PowerShell.Commands.SetDateCommand.SystemTime to struct. (#6006)
Change Microsoft.PowerShell.Commands.SetDateCommand.SystemTime class to struct and resolve the error in Set-Date cmdlet - SetLocalTime function is causing a parameter error (error code 0x00000057).
2018-01-25 07:54:27 +04:00
Aditya Patwardhan 5b5168d72e Revert "Pull PSReadLine from PSGallery" (#5986)
This reverts commit beffdcf94d.
2018-01-22 16:09:35 -08:00
Travis Plunk a603cf3867
Update csproj files to the latest version of the package references (#5961)
* Add function which tells you packages which probably need to be updated
2018-01-22 12:06:50 -08:00
Jason Shirk beffdcf94d Pull PSReadLine from PSGallery (#5759)
Instead of building PSReadLine from this repo, pull it from the gallery using nuget cache.

This pulls v2.0 of PSReadLine which does have documented breaking changes from v1.2, but the risk is small - the features that have changed are typically only used in a profile and aren't used all that often anyway.

Fix #996

Hardcodes version of modules pulled from PSGallery
2018-01-19 18:15:09 -08:00
Mark Kraus febc1e8bd0 Stop HttpListener from running in WebCmdlet tests (#5921) 2018-01-18 14:07:06 -08:00
Steve Lee 7437f3dd3a Encoding for New-ModuleManifest on all platforms should be UTF-8 NoBOM (#5923)
* encoding for new-modulemanifest on all platforms should be utf8nobom
* fix test
2018-01-17 16:37:53 -08:00
Ilya b27c6845b9 Update PowerShell to build with .NET Core 2.0.5 (#5903) 2018-01-17 15:11:50 -08:00
Steve Lee 7459b54639 Set-Location should use path with wildcard characters if it exists instead of globbing (#5839)
When InitialSessionState initializes it tries to SetLocation to current working directory,
 but if the directory name contains PowerShell wildcard characters, it fails and reverts
 to $PSHOME.
 The change affects Set-Location in that if the path exists (even if containing wildcard characters), just use it. It is a breaking change.
2018-01-17 08:58:55 +04:00
Ilya 89bdb1796c Update PowerShell to build with .NET Core 2.0.5 (#5903) 2018-01-16 17:36:37 -08:00
Mark Kraus 3f9564e665 Replace HttpListener Link Header Tests with WebListener (#5806)
- Add Link controller to WebListener
- Replace HttpListener Link tests with WebListener
- Update WebListener Documentation
- Enable cross-platform multiple Link header tests
2018-01-16 09:23:22 -08:00
Travis Plunk ab9a583516
fix version test to allow not to have a pre-release portion. (#5893) 2018-01-15 09:34:28 -08:00
Mark Kraus c8ccb376b4 [Feature] Replace HttpListener Echo Tests with WebListener (#5840) 2018-01-13 11:51:40 +04:00
Mark Kraus 211ee632dc [Feature] Replace HttpListener Redirect Tests with WebListener (#5872)
- adds type query to Redirect listener and adjusts logic to accommodate
- Replaces HttpListener Redirect Tests with WebListener
2018-01-13 11:51:04 +04:00
Ilya b6f18e7101
Add a test for IValidateSetValuesGenerator in a module (#5830)
Add a test that has been skipped in PR #5702
2018-01-10 13:02:33 +04:00
Mark Kraus bcb7252712 Convert WebCmdlets test to one-true-brace-style Formating (#5716) 2018-01-09 13:43:25 -08:00
Steve Lee 08c455a4ee Remove sc alias which conflicts with sc.exe (#5827) 2018-01-08 18:09:00 -08:00
Aditya Patwardhan 0687d5a564 Updated Help Uri to point to latest help content for Microsoft.PowerShell.Core module (#5820) 2018-01-08 18:09:00 -08:00
Dongbo Wang 658960e3f9 Move group policy settings and enable policy controlled logging in PowerShell Core (#5791)
Make PowerShell Core reads group policy settings from different registry keys (Windows only) and the configuration files (both Windows and Unix).
- On Windows, move to different GPO registry keys.
- On both Windows and Unix, read GPO related settings from the configuration file `powershell.config.json`.
- On Windows, the policy settings in registry take precedence over the configuration file.
- Enable policy controlled logging and transcription on Unix.
2018-01-08 18:09:00 -08:00
Steve Lee 0d893a59c7 Remove sc alias which conflicts with sc.exe (#5827) 2018-01-08 17:20:00 -08:00
Aditya Patwardhan d6288a3e2f Updated Help Uri to point to latest help content for Microsoft.PowerShell.Core module (#5820) 2018-01-08 16:37:59 -08:00
Dongbo Wang d261e1f166
Move group policy settings and enable policy controlled logging in PowerShell Core (#5791)
Make PowerShell Core reads group policy settings from different registry keys (Windows only) and the configuration files (both Windows and Unix).
- On Windows, move to different GPO registry keys.
- On both Windows and Unix, read GPO related settings from the configuration file `powershell.config.json`.
- On Windows, the policy settings in registry take precedence over the configuration file.
- Enable policy controlled logging and transcription on Unix.
2018-01-08 12:03:23 -08:00
Dongbo Wang 3b5badca04 Rename 'PowerShellProperties.json' to 'powershell.config.json' 2018-01-05 16:06:36 -08:00
Ilya 6825182a6a
Add ForEach and Where methods to [PSCustomobject] (#5756) 2018-01-05 22:54:31 +04:00
Dongbo Wang a6c62bfc58 [Feature] Minor changes to make ScriptBlock logging work with SysLog 2018-01-04 13:40:51 -08:00
Dongbo Wang 117e83a025 Add xUnit tests for reading Policy settings from config file 2018-01-04 13:40:51 -08:00
Dongbo Wang ad231a8a7f
Make minor fixes in Compiler to properly handle void type expression (#5764) 2018-01-02 09:25:29 -08:00
Ilya 7257404929
Add Count and Length properties to [PSCustomobject] (#5745)
Related #3671
•Add Count and Length properties to [PSCustomobject].
 Now following returns 1:
 ([pscustomobject] @{ foo = 'bar' }).Count
 ([pscustomobject] @{ foo = 'bar' }).Length
•Add tests
2017-12-28 10:15:06 +04:00
Mark Kraus 52cadf93c9 [Feature] Replace lee.io Tests with WebListener. (#5709) 2017-12-20 16:43:33 -08:00
Mark Kraus acf68f462c Replace Remaining HttpBin.org Tests with WebListener (#5665)
•Replaces all remaining test that rely on httpbin.org
•Adds Put, Post, Patch, and Delete tests to WebListener by means of routes to Get test and modifications to the Get controller.
•Adds responsephrase option to the Response test to accommodate error message tests
•removed redundant GET tests from irm and iwr tests.
•Fixed markdown linting errors in README.md for WebListener
2017-12-19 11:21:40 -08:00
Mark Kraus 79ae396917 [Feature] Replace lee.io Tests with WebListener. (#5709) 2017-12-19 08:29:46 +04:00
Mark Kraus 19197e11f3 Replace Remaining HttpBin.org Tests with WebListener (#5665)
•Replaces all remaining test that rely on httpbin.org
•Adds Put, Post, Patch, and Delete tests to WebListener by means of routes to Get test and modifications to the Get controller.
•Adds responsephrase option to the Response test to accommodate error message tests
•removed redundant GET tests from irm and iwr tests.
•Fixed markdown linting errors in README.md for WebListener
2017-12-13 19:28:05 +04:00
Travis Plunk 2b9059b9c0 Make the experience better when start-pspester doesn't find pester (#5673)
refactor code to restore pester into a separate function called Restore-PSPester
update message on what to do when pester is missing
Add ability for get-psoptions to default to new-psoptions
fix an issue with publish-pstesttools when a build has not been run since build.psm1 has been imported (try to use the default options)
make start-pspester use the last build, not just use the default options
fix an issue in restore caused some files not to be removed
2017-12-12 16:16:10 -08:00
Dongbo Wang 48961a5f68 Update PowerShell to build with .NET Core runtime 2.0.4 (#5677) 2017-12-12 16:16:10 -08:00
Travis Plunk 6ef94c1dfe
Make the experience better when start-pspester doesn't find pester (#5673)
refactor code to restore pester into a separate function called Restore-PSPester
update message on what to do when pester is missing
Add ability for get-psoptions to default to new-psoptions
fix an issue with publish-pstesttools when a build has not been run since build.psm1 has been imported (try to use the default options)
make start-pspester use the last build, not just use the default options
fix an issue in restore caused some files not to be removed
2017-12-12 16:07:12 -08:00
Dongbo Wang d966f59a11
Update PowerShell to build with .NET Core runtime 2.0.4 (#5677) 2017-12-12 13:53:22 -08:00
Aditya Patwardhan 9747bf4d7e Get GitCommitId using the ProductVersion from Assembly (#5651) 2017-12-10 10:29:53 -08:00
Aditya Patwardhan 0bcc2a2a8f Get GitCommitId using the ProductVersion from Assembly (#5651) 2017-12-08 11:37:29 -08:00
Manikyam Bavandla 6c373905da Update 'PowerShellGet' tests to validate the new install location of AllUsers scope. (#5633)
Changed the install location of AllUsers scope on PWSH to SHARED_MODULES location.
2017-12-07 17:57:08 -08:00