Commit graph

963 commits

Author SHA1 Message Date
Steve Lee ab764eeac1 Length script property for List View didn't include a name for the property so it defaulted to using the script as the property name (#4437) 2017-07-31 12:56:41 -07:00
Steve Lee 7667f05da7 Fix Invoke-Item test on macOS (#4435)
add defensive measures to have TextEdit start explicitly bypassing restoring previously open docs and to explicitly close TextEdit after the test.
2017-07-31 12:41:32 -07:00
Steve Lee 21f7f36756 Make invoke-item test Feature and increase timeout (#4382) 2017-07-28 17:47:56 -07:00
Travis Plunk 06d416b954 Merge pull request #4353 from SteveL-MSFT/deviceguard-startprocess
Fix DeviceGuard data being returned from Get-ComputerInfo and Start-Process test failure
2017-07-28 14:22:51 -07:00
Ilya 62f2a96cd9 Clean up '#if CORE' in OrderObjectBase.cs (#4371) 2017-07-28 11:29:43 -07:00
SteveL-MSFT 48625af83e added check to device guard not returning array 2017-07-28 11:28:02 -07:00
SteveL-MSFT d78e9ba19b [Feature]
In CI, notepad.exe isn't starting (or starting in time) when using start-process with .txt based on file association.
Since the test is validating opening files by association, fix is to create our own association that is predictable.
2017-07-28 10:58:12 -07:00
Steve Lee 03d4e9120b Support Invoke-Item -Path <folder> (#4262)
On CoreFx, UseShellExecute for Process start is false by default to be cross platform compatible.
In the case of a folder, Process.Start() returns Access Denied as it's not an executable.
On Windows, we can use the ShellExecute path to have explorer open the folder. On Unix, we use `xdg-open` and `open` for Linux and macOS respectively.
2017-07-27 22:17:38 -07:00
SteveL-MSFT 700a1c41ff [Feature]
fix Get-ComputerInfo return of status for DeviceGuard
fix corresponding tests
2017-07-26 15:08:24 -07:00
Steve Lee 0cd7a4a0c9 Fix error message when 'HelpMessage' property of 'ParameterAttribute' is set to empty string (#4334)
- Fix invalid value error message on some properties of ParameterAttribute to point to the specific properties.
- Avoid wrapping argument exception into not a useful 'requires' exception.
2017-07-26 09:20:43 -07:00
Travis Plunk f3dd2f0414 Merge pull request #3608 from DarwinJS/feature/install-powershell.sh
create script to install latest powershell from repositories
2017-07-25 18:48:20 -07:00
Travis Plunk e4dc938732 Get macOS working and fix misc issue 2017-07-25 17:55:42 -07:00
Dongbo Wang 0d8eff6446 Fix array expression to not return null or throw error (#4296)
This change fixes 3 issues:
- According to [PowerShell Language Specification Version 3.0](https://www.microsoft.com/en-us/download/details.aspx?id=36389), as quoted: "_The result is the (possibly empty) unconstrained 1-dimensional array_", `@(...)` should only return `object[]` array.
- `@([object[]]$null).GetType()` fails with error `"You cannot call a method on a null-valued expression."`
- `@([System.Collections.Generic.List[object]]$null)` fails with error `"Object reference not set to an instance of an object."`
2017-07-24 21:52:30 -07:00
Dongbo Wang 905e6978e6 [Feature]Fix regressions that cause implicit remoting tests to fail (#4326) 2017-07-24 08:17:41 -07:00
bergmeister ffd39b2853 PSScriptAnalyzer fixes by category (#4261)
- Fix PSScriptAnalyzer warnings of type PSAvoidUsingCmdletAliases for 'ForEach-Object' (alias is '%' or 'foreach')
- Fix PSScriptAnalyzer warnings of type PSAvoidUsingCmdletAliases for 'Where-Object' (alias is '?' or 'where')
- Fix PSScriptAnalyzer warnings of type PSAvoidUsingCmdletAliases for 'Select-Object' (alias is 'select')
- Fix PSScriptAnalyzer warnings of type PSPossibleIncorrectComparisonWithNull. Essentially, $null has to be on the left-hand side when using it for comparison.
- A Test in ParameterBinding.Tests.ps1 needed adapting as this test used to rely on the wrong null comparison
- Replace a subset of tests of kind '($object -eq $null) | Should Be $true' with '$object | Should Be $null'
2017-07-21 21:03:49 -07:00
Steve Lee e23d2e53d5 Add Test coverage for XmlCommand.cs (#4201) 2017-07-21 13:50:14 -07:00
Travis Plunk f1ff79011d Due to the use of unsupported APIs, we must remove the LocalAccounts module until a better solution is found. (#4302) 2017-07-19 17:20:35 -07:00
Travis Plunk 72a8de39b5 Due to the use of unsupported APIs, we must remove the Counter CmdLets in the Diagnostics Module until a better solution is found. (#4303) 2017-07-19 17:20:01 -07:00
Dongbo Wang d6265c303b Add test to validate 'Assembly.LoadFrom' behavior (#4285) 2017-07-18 22:10:59 -07:00
Mike Richmond 4f13bf476e Fix ConvertTo-Html single matched column header bug (#4276) 2017-07-18 14:13:54 -07:00
Steve Lee b70460fb93 updated webcmdlets CI tests to not depend on external website (#4279)
* updated webcmdlets CI tests to not depend on external website

* When used in background runspace, validate listener is working before returning

* fix possible infinite loop waiting for listener to start
2017-07-18 12:33:40 -07:00
Steve Lee 44e377525b Register-PSSessionConfiguration fails if SesionConfig folder doesn't exist (#4271) 2017-07-18 10:07:05 -07:00
Dongbo Wang 069c7a4b6f Enable DataRow/DataRowView adapters in PowerShell Core (#4258) 2017-07-17 11:27:01 -07:00
Dongbo Wang c5f3a19caf Run PowerShell class static methods in the correct Runspace/SessionState (#4209)
Summary
----------
When the same script file gets executed in multiple Runspaces, the RuntimeType generated from the powershell class defined in the file will be shared among those Runspaces. For different Runspaces, different SessionState should be used to run the static methods.

Fix
---
We use the `SessionStateKeeper` to query for the correct `SessionState` to use for a static method call.
We already use `SessionStateKeeper` to track the `Runspace/SessionState` where a PowerShell class is defined, and thus we can leverage this for the static method invocation.
2017-07-14 18:05:48 -07:00
Ilya 23c9b934ef Fix C# tests for ValidateSetValuesGenerator (#4253) 2017-07-14 13:02:58 -07:00
Paul Higinbotham 7fa0dd0549 Fix for implicit remote regression in restricted session (#4222) 2017-07-14 12:28:22 -07:00
Dan Travison ea758a53af Add -SkipHeaderValidation switch to Invoke-WebRequest and Invoke-RestMethod to support adding headers without validating the header value. (#4085)
* Add -SkipHeaderValidation switch to Invoke-WebRequest and Invoke-RestMethod to support adding headers without validating the header value.

* Fix whitespace
2017-07-14 10:24:20 -07:00
David Christian e333ac3ab9 Added tests for built-in type accelerators (#4230) 2017-07-14 09:53:28 -07:00
Paul Higinbotham 02737e2fe4 Fixes CIM deserialization bug (#4234) 2017-07-14 09:52:24 -07:00
Ilya dc76c86f7a ValidateSetAttribute enhancement: support set values to be dynamically generated from a custom ValidateSetValueGenerator (#3784)
Currently `ValidateSetAttribute` accepts only explicit constants as valid values. This is a significant limitation. Sometimes we need to get valid values dynamically, ex., Azure VMs, logged-on users and so on. The PR add follow possibilities:
- pass a _custom type_ (a valid values generator) implementing `IValidateSetValuesGenerator` interface to get valid values dynamically.
- pass a _custom type_ (a valid values generator) derived from `CachedValidValuesGeneratorBase` abstract class to get valid values dynamically and _cache_ the list to share with other ValidateSetAttribute attributes.
2017-07-13 21:28:32 -07:00
Travis Plunk 7d50e5e5b0 Fix maintainer readme syntax (#4226) 2017-07-11 16:15:11 -07:00
Steve Lee db813b6bae add test coverage for -notcontains, -is, -isnot operators (#4179)
* added test coverage for -notcontains, -is, -isnot operators

* cleaned up tests to use -TestCases, added missing -cnotcontains test
2017-07-11 12:27:04 -07:00
jeffbi a9b8e98449 Remove unneeded test hooks and tests due to behavior change in .NET Core (#4200) 2017-07-08 15:18:48 -07:00
Steve Lee 7bce1653f3 Add Windows PowerShell PSModulePath by default on Windows (#4132)
This change is only for Windows and appends the Windows PowerShell PSModulePath on startup via a default profile. Depending on the data/feedback we get, we can decide what to do (opt-in vs opt-out) as we get closer to a release candidate.
2017-07-07 09:43:37 -07:00
Aditya Patwardhan 51c7861da6 Updated Code Coverage badge and filtered out PSReadline module (#4121) 2017-07-07 09:29:23 -07:00
Steve Lee 8f8580a408 Fix usage of -TestCases so that the parameters show up in the test case description (#4188) 2017-07-07 09:25:46 -07:00
jeffbi 1688703caf Make Get-ChildItem follow symlinks on demand, with checks for link loops (#4020)
Add the dynamic parameter `-FollowSymlink` to `Get-ChildItem`.
Add a mechanism for tracking visited directories.
Add native code to get device/inode information on Unix/Windows.
Add warning when refusing to enter an already-visited directory.
2017-07-06 12:28:27 -07:00
Tim Curwick d1e05efbf1 Added comma to the list of replaced characters in assemblyname (#4136) 2017-07-06 11:32:54 -07:00
Steve Lee dda482eaac Add markdown lint errors as test failure message (#4189) 2017-07-05 21:47:42 -07:00
Bruce Payette ece27ff687 Fix spurious error generated when importing cmdlets from an in-memory assembly (#4117) 2017-06-30 15:36:38 -07:00
Dongbo Wang 3e35fb9918 Move powershell to 2.0.0-preview3-25426-01 using the .NET CLI 2.0.0-preview2-006502 (#4144) 2017-06-30 13:07:14 -07:00
Andrew ecefb50d0d Fixing Import-Module on Linux for special cases of NestedModules/RootModule path format (#4010)
* IPMO fix for some cases of NestedModules/RootModule path syntax

* Added tests for #3693 fix

* Updated tests
2017-06-28 16:35:33 -07:00
Steve Lee 042a6f2534 Need explicit -command to execute command in Read-Host output test (#4103) 2017-06-28 10:13:37 -07:00
Keith Hill 27e47f9ee1 Implement Unicode escape parsing (#3958)
* Implement Unicode variable width `u{xxxxxx} escape sequences.
2017-06-27 22:55:57 -07:00
Andrew e2e07b1830 Change New-ModuleManifest encoding to UTF8NoBOM on non-Windows platforms (#3940)
* Change New-ModuleManifest encoding to UTF8NoBOM

* Addressed PR feedback

* Fixed test for Travis CI

* Updated tests
2017-06-27 12:48:25 -07:00
Maria Romero 471f4e8a48 Add tab completion for Export-Counter -FileFormat parameter (#3856)
* add tab completion for -FileFormat parameter

* update expected error for invalid -FileFormat test case
2017-06-25 12:13:57 -07:00
jeffbi 5ee4ec1e1e Make Move-Item work with its -Include, -Exclude, and -Filter parameters (#3878)
* Make Move-Item work with its -Include, -Exclude, and -Filter parameters (#2385)

Invoke the correct overload of SessionState.Path.GetResolvedPSPathFromPSPath, passing the cmdlet context object.

* Update tests per code review.

* Changes per code review.

* Remove stray comment
2017-06-22 19:14:51 -07:00
Aditya Patwardhan 7491417bf9 Fixed BaseDirectory tests by adding -c instead of positional argument (#4078) 2017-06-22 13:35:04 -07:00
Staffan Gustafsson b65bc62934 Add type inference for Foreach-Object -MemberName (#3972)
This PR adds type inference support for the 'MemberName' parameterset for Foreach-Object.

Both of the following should work:

```
    Get-Process | % {$_.MainModule} | % Com<Tab>
    Get-Process | % MainModule | % Com<Tab>
```

Before this change, only the first line worked, this PR addresses the second line.

Fixes #2596
2017-06-22 13:34:33 -07:00
Aditya Patwardhan c7b959bd6e Make CodeCoverage tests work with CodeCov.io and related fixes (#4050)
* Fixed OpenCover module and CodeCoverage launcher script

* Changes to layout of package caused some changes to package path.
* Added Test modules from tests\tools\modules
* Fixed Get-ChildItem test
* Added convertor for converting OpenCover output file to JSON.
* Updated how the file is uploaded to CodeCov.io

* Addressed code review comments
2017-06-21 19:20:10 -07:00