Commit graph

1869 commits

Author SHA1 Message Date
Steve Lee 592f897d21 allow test to work in cases where you can't create $profile 2019-05-04 07:44:30 -07:00
Steve Lee 3b5663ee97 correctly delete $profile in all cases 2019-05-04 07:12:53 -07:00
Steve Lee 0c1274011c fix creation of profile 2019-05-04 06:45:43 -07:00
Aditya Patwardhan 2737e74d86 Fix null reference when Microsoft.PowerShell.Utility is loaded as a snapin in hosting scenarios (#9404) 2019-05-03 15:16:41 -07:00
Steve Lee a69b20be3e add test 2019-05-03 11:12:46 -07:00
Steve Lee 3bfca6d0fa Update use of Windows PowerShell to just PowerShell (#9508) 2019-05-03 15:38:06 +05:00
ThreeFive-O 0735c95c3f Add unit and feature tests for Send-MailMessage (#9213) 2019-05-02 10:37:50 -07:00
xtqqczze a702f68974 Ensure Wait-UntilTrue returns $true in Pester tests (#9458) 2019-05-01 17:03:43 -07:00
Steve Lee d318e7727e Allow passing just a dash as an arg to a file via pwsh (#9479) 2019-04-27 11:20:33 -07:00
Dongbo Wang 687697bc90 Fix the failed test and update 'Publish-TestResults' to make AzDO fail the task when any tests failed (#9457) 2019-04-25 14:01:05 -07:00
Andrew 095be4655e
Return correct casing of filesystem path during normalization (#9250)
* return correct casing of filesystem path during normalization

* handle UNC case

* handle case to add trailing separator back

* add support for NTFS streams syntax

* add case-sensitive test

* only apply correct casing to directories

* handle 8.3 path syntax

* fix short path processing
2019-04-23 13:31:43 -07:00
Steve Lee 5e58e30d20 Move warning message to EndProcessing so it only shows up once (#9385) 2019-04-23 13:31:20 -07:00
dependabot[bot] 600a93750e Build(deps): Bump gulp from 4.0.0 to 4.0.1 in /test/common/markdown (#9441) 2019-04-23 11:06:39 -07:00
pougetat 0bd93777fc Adding tests for Remove-Module (#9276) 2019-04-22 10:49:58 -07:00
Tyler James Leonhardt 9140e421ec Add wildcard back to end of tab completion command lookup (#9383)
Re-add wildcard when searching AST + Missed test case.

## PR Context

In #8109, we removed the line that added a wildcard to the end of the command that was used to match commands in the script AST. This readds that line closer to where it is used.
2019-04-18 11:42:49 -07:00
Travis Plunk cee1e54e75
Add ability to cross compile (#9374)
`-CrossGen` won`t work, but this gives basic ability to build for another platform.
This also means you cannot really package for another platform.
2019-04-16 14:14:29 -07:00
Tyler James Leonhardt 13fd3af810 New New-PSBreakpoint cmdlet & new -Breakpoint parameter for Debug-Runspace (#8923)
This PR does 4 things:

* Adds a new cmdlet `New-PSBreakpoint` which creates new `Breakpoint` objects and writes them to the pipeline
* Adds a `-Breakpoint` parameter to `Debug-Runspace` which will receive `Breakpoint` objects
* Makes the constructors for `*Breakpoint` public for use with the API
* Makes `Debugger.GetBreakpoint(string id)` and `Debugger.GetBreakpoints()` public since `SetBreakpoints` is public

Note: `New-PSBreakpoint` and `Set-PSBreakpoint` (which already exists) are similar... but `Set-PSBreakpoint` also sets the breakpoints in the _current_ runspace. This is not ideal if we want to set breakpoints in a _different runspace than the current one_.

## PR Context  

The "Attach to process" debugging experience in the PowerShell extension for VSCode is _ok_ but it's not great.

The reason it's not great is due to the `BreakAll` feature of PowerShell debugging which, when you run `Debug-Runspace`, will break at the first piece of code that gets run. This is not ideal when you "Attach to process" _and then_ run your code in the other runspace.

Today, the experience drops you in `PSReadLine`'s psm1 if PSRL is available or in the vscode PowerShell helper psm1.

It's unexpected for the user and not ideal.

This PR will allow the extension to pass in the breakpoints that need to be set initially with `BreakAll` turned off for none of this silly behavior.

### Silly behavior example

If you want a repro, try this:

PowerShell instance 1:
```
Enter-PSHostProcess -Id $otherprocesspid
Debug-Runspace 1
```

PowerShell instance 2:
```
./runfoo.ps1
```

Note that you end up NOT `runfoo.ps1`
2019-04-13 19:14:53 -07:00
Travis Plunk 5913c88aaf
Mark tests in macOS CI which use applescript as pending/inconclusive (#9352)
Mark tests in macOS CI which use applescript as pending/inconclusive
2019-04-12 18:12:29 -07:00
James Truher [MSFT] 1006db647b Reduce time for stack overflow test (#9302)
Create a small class to do the work.
I saw 100x performance improvement in this test.
2019-04-12 14:21:33 -07:00
Sytze Andringa 4884317d00 Added more tests for import-alias by file regarding parsing difficult aliases strings (#9247) 2019-04-11 10:40:24 -07:00
Reece Dunham 2d87948d8e Move from npm to Yarn for markdown tests (#9312)
Yarn is better because...
* it validates package checksums
* it has emojis 🤟
* it is faster and employs better caching
2019-04-10 14:16:22 -07:00
Dongbo Wang e299a30128 Fixing test run crash by not passing script block to the callback (#9298) 2019-04-08 11:06:27 -07:00
Travis Plunk 98b2e147c1
Only search for functions in Constrained Language help tests (#9301)
Only search for functions in Constrained Language help tests

## PR Context

Searching for only functions is faster
2019-04-08 11:01:33 -07:00
Steve Lee b63696572f Fix skipping of tests in RemoteSession.Basic.Tests.ps1 (#9304)
Moved check if able to write to $PSHome as way to skip test to `BeforeAll` which already contained a check if running on Windows.

## PR Context

As part https://github.com/PowerShell/PowerShell/pull/9279, tests were updated to be skipped if the test requires writing to `$PSHome` but is not able to.  However, these tests already had a skip mechanism in place so the additional check caused the test to run when it should have skipped.

Co-authored-by: Travis Plunk <github@ez13.net>
2019-04-05 17:00:41 -07:00
Ilya b927c46eb4
Add QuoteFields parameter to ConvertTo-Csv and Export-Csv (#9132) 2019-04-05 22:19:01 +05:00
Steve Lee b8317de469 Update tests to account for when $PSHOME is readonly (#9279)
Co-Authored-By: SteveL-MSFT <slee@microsoft.com>


Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2019-04-04 23:01:01 -07:00
Staffan Gustafsson 4ec36a0d4a Fixing progress for Get-ComputerInfo (#9236) 2019-04-04 16:15:43 -07:00
Joel Sallow (/u/ta11ow) 3f52adb0ae Add Binary Parsing Support & Refactor TryGetNumberValue & ScanNumberHelper (#7993)
Fixes #7557 

* Adds support for binary parsing in format echoing hex: `0b11010110`
  * Works with all existing type suffixes and multipliers.
  * Supports arbitrary length parsing with `n` suffix using BigInteger; details below.
* Adds `NumberFormat` enum to specify hex/binary/base 10 for the tokenizer, replacing old `bool hex`.
* Adds `n` suffix for all numeric literals to support returning value as a `BigInteger` if requested. This bypasses the issue of large literals losing accuracy when they cast through `double`.
* Adds tests for all new behaviours.

---

### Binary / Hex Parsing Implementation

* Mimics old sign bit behaviour for int and long types. Sign bits accepted for 8 or 16-bit Hex parsing, and 8, 16, 32, 64 for binary.
  * i.e., `0xFFFFFFFF -eq ([int]-1)` and `0xFFFFFFFFFFFFFFFF -eq ([long]-1)`, but suffixing `u` creates `int.MaxValue` and `long.MaxValue`, respectively, instead.
* Sign bits higher than this are accepted for bigint-suffixed numerals:
    * Hex: Bigint-suffixed hex treats the high bit of any literal with a length multiple of 8 as the sign bit
    * Binary: Bigint-suffixed binary accepts sign bits at 96 and 128 chars, and from there on every 8 characters.
    * Prefixing the literal with a 0 will bypass this and be treated as unsigned, e.g. `0b011111111`
* Specifying an `u`nsigned suffix (or combination suffix that includes `u`) ignores sign bits, similar to how parsing a hex string using `[Convert]::ToUint32()` would do so.
* Supports negating literals using `-` prefix. This can result in positive numbers due to sign bits being permitted, just like hex literals.

---

### Refactored numeric tokenizer parsing

**New flow:**

1. Check for `real` (`.01`, `0.0`, or `0e0` syntaxes)
    1. If the decimal suffix is present, TryParse directly into decimal. If the TryParse fails, TryGetNumberValue returns `false`.
    2. TryParse as `Double`, and apply multiplier to value. If the TryParse fails, TryGetNumberValue returns `false`.
        1. Check type suffixes and attempt to cast into appropriate type. This will return `false` if the value exceeds the specified type's bounds.
        2. Default to parsing as `double` where no suffix has been applied.
2. Check number format.
    * If binary, manually parse into BigInteger using optimized helper function to directly construct the BigInteger bytes from the string.
    * If hex, TryParse into `BigInteger` using some special casing to retain original behaviours in int/long ranges.
    * If neither binary nor hex, TryParse normally as a `BigInteger`.
3. Apply multiplier value before attempting any casts to ensure type bounds can be appropriately checked without overflows.
4. Check type suffixes.
    * If a specific type suffix is used, check type bounds and attempt to parse into that type.
      * If the value exceeds the type's available values, the parse fails. Otherwise, a straight cast is performed.
5. If no suffix is used, the following types are bounds-checked, in order, resulting in the first successful test determining the type of the number. 
    * `int`
    * `long`
    * `decimal` (base-10 literals only)
    * `double` (base-10 literals only)
    * ~~`BigInteger` for binary or hex literals.~~ If the value is outside `long` range (for hex and binary) or `double` range (for base 10), the parse will fail; higher values must be explicitly requested using the `n`/`N` BigInteger suffix.

---

*This is a breaking change* as binary literals are now read as numbers instead of generic tokens which could potentially have been used as function / cmdlet names or file names.

Notes:
* Binary literal support was approved by the committee in #7557 
* ~~The same issue is still under further discussion for underscore support in numeric literals and whether BigInteger parsing ought to be exposed to the user at all.~~
    * ~~Supporting underscore literals is a further breaking change causing some generic tokens like `1_000_000` to be read as numerals instead.~~ Per @SteveL-MSFT's [comment](https://github.com/PowerShell/PowerShell/pull/7993#issuecomment-442651543) this proposal was rejected.
    * ~~Removing underscore support or preventing standard parsing from accepting BigInteger ranges is a relatively trivial matter. It is my personal opinion that there is no particular reason *not* to hand the user a BigInteger when they enter a sufficiently large literal, but I will defer to the PowerShell Committee's judgement on this.~~
2019-04-03 15:10:02 -07:00
Travis Plunk 5e4b4d1351 Make command searcher not use wildcard search for execution (#9202) 2019-04-02 11:54:11 -07:00
Rene Hernandez 75da390d1e Add ItemSeparator and AltItemSeparator properties in ProviderInfo (#8587)
Add two properties in `ProviderInfo` class: `ItemSeparator` and `AltItemSeparator`.
On windows, the default values for those two properties are `ItemSeparator = '\'` and `AltItemSeparator = '/'`.
On unix, the default values for those two properties are `ItemSeparator = '/'` and `AltItemSeparator = '\'`.

Registry provider is the only exception, both properties for it have the value `\`.
2019-04-02 09:59:36 -07:00
Steve Lee (POWERSHELL) 882e94f1cb add case-sensitive test 2019-03-30 09:40:14 -07:00
pougetat 0ee5278b40 Fix Get-Module -FullyQualifiedName option to work with paths (#9101) 2019-03-29 15:27:09 -07:00
Steve Lee 6bc2b55fdf return correct casing of filesystem path during normalization 2019-03-29 13:22:52 -07:00
pougetat e553aef0fb Implement Get-Random -Count without specifying an InputObject list (#9111) 2019-03-26 16:50:20 +05:00
Steve Lee 3255d84627 Enable SecureString cmdlets for non-Windows (#9199)
On Unix systems, fallback to plaintext manipulation instead of using the DPAPI which is not available.

## PR Context

Currently, existing scripts that use SecureString cmdlets fail with an error complaining about crypt32.dll not being available.  This change allows these cmdlets to be used, but there is no encryption of the string.
.Net already [states](https://docs.microsoft.com/en-us/dotnet/api/system.security.securestring?view=netcore-2.1#remarks) that the contents of a SecureString are not encrypted on .Net Core.

Fix https://github.com/PowerShell/PowerShell/issues/1654

Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2019-03-23 10:11:05 -07:00
Ilya cc6540b614
Cleanup style issues in CoreAdapter and MshObject (#9190) 2019-03-23 09:52:30 +05:00
Travis Plunk 94616f1789
Add Obsolete message to Send-MailMessage (#9178)
Add Obsolete message to Send-MailMessage

## PR Context

See https://github.com/PowerShell/PowerShell-RFC/pull/160

Co-authored-by: Steve Lee <slee@microsoft.com>
Co-authored-by: Ilya <darpa@yandex.ru>
2019-03-22 12:52:41 -07:00
Travis Plunk 185f20e3bd
Add tests for command globbing (#9180)
Add tests for command globbing
  - Also, add `-noprofile` to places where `pwsh` is launched so they don't fail locally.
2019-03-21 13:49:57 -07:00
Staffan Gustafsson 42c289fc8e Improve formatting performance by having better primitives on PSObject (#8785)
By not doing excessive amounts of extra work, formatting can be sped up quite significantly (about 8x faster).
The main change comes from adding new, more efficient, primitive to query an object for the existence of an instance member.
The formatting system has been checking for if an object has properties other than some decorated properties added by PS remoting, and it doesn't this by retrieving all properties which results in heavy allocations and wasted cycles.
By adding `GetFirstOrDefault` to `PSObject` and similar primitives to the underlying Adapters, we are able to return early, without having to get all properties back.
2019-03-20 18:43:52 -07:00
Patrick Meinecke b4ebf63335 Improve type inference of array literals and foreach statement variables (#8100)
Improve type inference for foreach statement variables by:

Inferring strongly typed arrays from explicit array and array literal expressions when elements are of the same inferred type

Fix detection of foreach variable declaration. The previous logic was to check if the variable expression's start offset was after the end offset of the foreach statement, which will never be true in the body

Improve inference of what type the "Condition" of a foreach statement will enumerate as
2019-03-19 13:36:27 -07:00
Dongbo Wang 24d3152f00 Make Start-Job throw terminating exception when -RunAs32 is specified in 64-bit pwsh (#9143) 2019-03-18 10:23:29 -07:00
Staffan Gustafsson e91d6dcf56 Adding CmdletsToExport and AliasesToExport to test module manifests. (#9108) 2019-03-18 11:09:05 +05:00
Jacob Scott 8f6982cc8a Made -Subject parameter of SendMail command no longer mandatory. (#8961) 2019-03-18 08:24:57 +05:00
pougetat 5277c79d67 Clean up Get-Random cmdlet (#9133) 2019-03-16 13:54:35 +05:00
Dongbo Wang cdb28a1067 Make 'Start-Job' throw terminating error when PowerShell is being hosted (#9128) 2019-03-13 17:57:42 -07:00
Reece Dunham 78f4ba5ec1 Update AppVeyor comments in Implicit.Remoting.Tests.ps1 (#9020) 2019-03-13 12:52:35 -07:00
pougetat a79ed1ef0f Make New-ModuleManifest consistent with Update-ModuleManifest (#9104) 2019-03-13 12:01:42 -07:00
Joel Sallow (/u/ta11ow) 18d5037ad2 Fix -NoEnumerate behaviour in Write-Output (#9069)
Fix is to preserve input collection type in output.
The regression was caused by #2038
2019-03-13 13:54:12 +05:00
Ilya e75bd1482f
Add support empty NoteProperty in Group-Object (#9109) 2019-03-13 11:22:05 +05:00
Staffan Gustafsson 9983297254 Removing Hardlink from Mode property in default file system format (#8789) 2019-03-12 15:49:16 -07:00
James Truher [MSFT] e605fbdea7 Fix tab completion test to handle multiple matches (#8891) 2019-03-11 14:51:22 -07:00
Staffan Gustafsson 0ebbdc1cc4 Fixing issue with help progress with Get-Help not calling Completed (#8788) 2019-03-11 11:26:01 -07:00
Tyler James Leonhardt a26d639a47 Fix Enter-PSHostProcess tests flakiness (#9007) 2019-03-11 10:41:06 -07:00
pougetat e3829cb60f Allow Test-ModuleManifest to work when RootModule has no file extension (#8687) 2019-03-10 14:57:19 -07:00
Reece Dunham 43487b4068 Update markdown test dependencies (#9075) 2019-03-09 08:30:14 +05:00
Dongbo Wang 50f3e7f10e
Update the task-based async APIs added to PowerShell to return a Task object directly (#9079)
Update the task-based async APIs added to PowerShell to not use the `aysnc/await` keywords, but to return a `Task` object directly.
There is nothing to continue on after the `Task.Factory.FromAsync` call in those methods, so there is not need to use `aysnc` and `await` keywords, which turns the method into a state machine class unnecessarily.
2019-03-07 11:24:31 -08:00
Aditya Patwardhan 0752a5502a
Add source for install-package to install netDumbster (#9081) 2019-03-06 16:21:03 -08:00
Ilya 2953959dc5 Add UseQuotes parameter (#8951) 2019-03-06 11:59:15 -08:00
Kirk Munro 45aba2acb5 Add 5 'InvokeAsync' overloads and 'StopAsync' to the 'PowerShell' type (#8056) 2019-03-06 10:06:11 -08:00
ThreeFive-O d56e50152a Style fixes for Select-Xml tests (#9037) 2019-03-05 15:07:00 -08:00
ThreeFive-O a2c9482194 Enable cross-platform Send-MailMessage tests for CI (#8859) 2019-03-05 14:29:48 -08:00
Reece Dunham da4930f2dc Added RequireSudoOnUnix tags to PowerShellGet tests and unmark as pending (#8954) 2019-03-05 11:55:20 -08:00
ThreeFive-O 6e383de251 Style fixes for ConvertTo-Xml tests (#9036) 2019-03-05 11:39:58 -08:00
dependabot[bot] 98506db714 Build(deps): Bump SelfSignedCertificate in /test/tools/Modules (#9055) 2019-03-05 11:32:40 -08:00
ThreeFive-O 017e472961 Align name schemes for test files (#9034) 2019-03-05 10:47:04 -08:00
Aditya Patwardhan 7062297e4e
Update version for PowerShell.Native and hosting tests (#8983) 2019-03-04 11:08:19 -08:00
Gaurav Kamath f31b33863c Refactor Shuffle in Get-Random to save a full iteration of the objects. (#8969) 2019-03-01 17:11:37 +05:00
Ilya 18f9a36f2a Pending NamedPipeConnectionInfo test (#9003)
Related #8971. Pending the test until we fix a root case of failure.
2019-02-27 14:51:36 -08:00
mjanko5 7e0411fcd9 Add test for -WhatIf for New-FileCatalog (#8966) 2019-02-27 10:53:08 +05:00
Dongbo Wang 5d54f1aa38
Make xUnit tests run sequentially to avoid race conditions caused by manipulating 'powershell.config.json' in tests (#8945) 2019-02-22 11:57:10 -08:00
Tyler James Leonhardt 23eccfd641 [feature] Add -CustomPipeName to pwsh and Enter-PSHostProcess (#8889)
This allows a user to start PowerShell up with the name of the named pipe that is used for cross process communication (I.e. Enter-PSHostProcess).
2019-02-22 23:40:03 +05:00
Andrea Spadaccini af86157855 Fix typo: aganist ➜ against (#8943) 2019-02-22 18:46:31 +05:00
Ilya 778920bbc4
Use verbatim string literals for paths (#8937) 2019-02-22 11:35:32 +05:00
Travis Plunk 57aeca428e
Port Security bypass fixes from 6.1.3 (#8915) 2019-02-21 13:44:08 -08:00
Travis Plunk 2c488fb4e5
Fix Markdown lint issues (#8929)
#8896 Broke the static analysis CI.  Fixing so CI passes
2019-02-20 13:24:26 -08:00
Steve Lee b06ad6aa61 Enable discovering modules that have names same as a culture (e.g. Az) (#8777)
Here are the major changes:
- Add logic to skip checking for possible resource directories for the first set of sub directories from the top level.
- There was an additional skip if the folder is hidden, rather than doing an explicit attribute check, change the `EnumerationOption` to skip hidden folders.
- Since the `IsPossibleModuleDirectory()` helper now only checks to see if the name matches a culture, renamed to `IsPossibleResourceDirectory()`
- When getting the default modules, we don't search recursively into individual module folders, so removed additional check for possible resource directory.
2019-02-20 12:23:27 -08:00
Reece Dunham 4de3a72142 Fix code-of-conduct linting (#8896) 2019-02-20 11:57:31 +05:00
Adam Gauthier caf8ac6a6a Add configurable maximum depth in ConvertFrom-Json with -Depth (#8199)
Adds an optional -Depth parameter to the cmdlet which lets the user to specify a maximum depth allowed for deserialization, which will overwrite the default maximum of 1024.
2019-02-20 10:37:37 +05:00
Mathias R. Jessen 0a570211df Flatten interface hierarchy when generating properties that implement interface properties (#8382)
`TypeBuilder.GetInterfaces()` returns only the interfaces that was explicitly passed to its constructor, so we need to flatten the interface hierarchy in order to properly support inherited interfaces.
2019-02-19 15:02:34 -08:00
Reece Dunham c14d5dd67f Remove some of the last AppVeyor references (#8867)
This removes some of the last mentions of the AppVeyor name.  Don't change the title, we don't want the word to appear in the CLs
Also problem: the last references are in the changelogs but I don't want to modify them without committee approval.  

## PR Context  

it was removed, #8686
2019-02-19 12:44:00 -08:00
Travis Plunk 60ab54d737
Port DotNet fixes from 6.1.3 (#8914)
Addresses CVE-2019-0657
2019-02-19 10:45:40 -08:00
Reece Dunham 6cab2b474d Remove yet another appveyor reference (#8854) 2019-02-11 10:28:41 -08:00
Reece Dunham 3ab7e2ec4d Remove extra AppVeyor environment check (#8709)
Removes a check for AppVeyor env

## PR Context  
AppVeyor removed (#8686  extension)
2019-02-08 10:57:41 -08:00
Steve Lee 26a58670c1 Enable creating relative symlinks on Windows with New-Item (#8783) 2019-02-07 11:44:23 -08:00
Bruce Payette 6bc6257a55 Allow .exe files to be used as IL binary modules (#7281)
Fix for #6741 Allow .exe files to be used as binary modules. Basically anywhere a .dll could be used with modules, you can now use a .exe file. Also did a little clean up, replacing constant strings with the StringLiteral values instead.
2019-02-07 11:24:06 -08:00
Joel Sallow (/u/ta11ow) 130298bfae Parse numeric strings as numbers again during conversions (#8681) 2019-02-04 12:22:05 -08:00
Travis Plunk 003a141f31
Remove directory causing static analysis failure (#8812)
Remove directory causing static analysis failure
2019-02-01 18:03:12 -08:00
Steve Lee 313c8c06a1 Enable Write-Information to accept $null (#8774) 2019-01-31 13:16:34 -08:00
Reece Dunham 9e4e50a84e Remove appveyor functions from New-DockerTestBuild.psm1 (#8756) 2019-01-31 11:15:31 -08:00
Joshua T c935bce1ac Adding parameter "ReplyTo" to Send-MailMessage (#8727) 2019-01-30 16:33:15 -08:00
Paul Higinbotham f3efcab91e Change xUnit RunspaceTests to run sequentially (#8796) 2019-01-30 14:12:26 -08:00
pougetat 1d7651f233 Fix Get-Help PSTypeName issue with -Parameter when only one parameter is declared (#8754) 2019-01-30 08:55:33 -08:00
Ilya 5097e2ae1f Fix cleanup config files for the csharp xUnit tests (#8761) 2019-01-29 17:24:18 -08:00
Reece Dunham 5581c0a0ed Update some info in md-link-checks (#8757) 2019-01-29 08:54:23 +05:00
Travis Plunk b779b88c79
Merge `release-v6.2.0-preview.4'
# Conflicts:
#	test/Test.Common.props
#	tools/packaging/packaging.psm1
2019-01-28 13:50:00 -08:00
Joel Sallow (/u/ta11ow) db1b309800 Correctly Report impact level when SupportsShouldProcess is not set to 'true' (#8209)
Major changes are:
- Make all commands return 'ConfirmImpact.None' if `SupportsShouldProcess` is not set to `true`.
- Update some cmdlets to explicitly use `ConfirmImpact.Low`.
- Update `DefaultCommands.Tests.ps1` to test for 'ConfirmImpact' level.
2019-01-26 03:12:00 -08:00
Mark Kraus ff83206e1c Fix Request Charset Issues in Web Cmdlets (#8742)
Instantiating a new MediaTypeHeaderValue object fails when the -ContentType parameter includes a charset such as application/json; charset=utf-8. This makes it impossible to set the content encoding on web requests. Moving to Parse() ensures we actually get a proper MediaTypeHeaderValue when the charset is present, thus allowing users to set their request encoding via proper -ContentType values.
2019-01-26 12:48:47 +05:00
Aditya Patwardhan 6ccbebda27 Improve check for developer mode by checking minimum required build number (#8749)
* Improve check for developer mode by checking minimum required build number

The test would fail if the developer mode is enabled but the machine has an older build than the minimum required build.
The change adds a check for the build version in the test.

* Update test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1
2019-01-25 13:14:29 -08:00
Sergey Vasin a9841d98fa Make Join-String -InputObject 1,2,3 result equal to 1,2,3 | Join-String result (#8611)
Make `Join-String -InputObject 1,2,3` result equal to `1,2,3 | Join-String` result.

Fix #8610
2019-01-24 12:53:37 -08:00
xtqqczze 863528881f Use https in URLs where available (#8622)
Use https in URLS across the repository where the domain serves content by https.
2019-01-24 12:50:11 -08:00
dependabot[bot] 60edeb2c76 Build(deps): Bump XunitXml.TestLogger from 2.0.0 to 2.1.26 (#8731) 2019-01-24 11:01:24 -08:00
Steve Lee 3a8205018e Fix Enter-PSHostProcess test to wait until runspace is ready before attempting to enter (#8725)
This fixes CI test failure in Windows build.
2019-01-23 15:07:34 -08:00
Steve Lee 7e2cd7954f Add the experimental feature for creating 'Temp:\' drive when FileSystemProvider initializes (#8696)
Adds Experimental Feature called `PSTempDrive` that, if enabled, creates a PSDrive called `Temp:` that maps to `[System.IO.Path]::GetTempPath()`.
2019-01-23 13:53:04 -08:00
Dongbo Wang 9ceddc0dfe
Refactor ConvertTo-Json to expose JsonObject.ConvertToJson as a public API (#8682)
We have the public API `JsonObject.ConvertFromJson` to convert from JSON string in the PowerShell context. It would be good to have a public API for conversion to JSON. This PR refactors the `ConvertTo-Json` cmdlet to move the core implementation to `JsonObject.ConvertToJson`, and make `ConvertTo-Json` call that public method.

This would help the Azure Function PowerShell worker. Currently, we depends on [calling the cmdlet](729710d259/src/PowerShell/PowerShellManager.cs (L198-L205)) to convert object to JSON which is expensive. Once we have the public method `JsonObject.ConvertToJson` exposed, we can call the API directly to avoid a command invocation.

# Conflicts:
#	test/Test.Common.props
2019-01-23 10:41:19 -08:00
Dongbo Wang c606b1ca37 Refactor ConvertTo-Json to expose JsonObject.ConvertToJson as a public API (#8682)
We have the public API `JsonObject.ConvertFromJson` to convert from JSON string in the PowerShell context. It would be good to have a public API for conversion to JSON. This PR refactors the `ConvertTo-Json` cmdlet to move the core implementation to `JsonObject.ConvertToJson`, and make `ConvertTo-Json` call that public method.

This would help the Azure Function PowerShell worker. Currently, we depends on [calling the cmdlet](729710d259/src/PowerShell/PowerShellManager.cs (L198-L205)) to convert object to JSON which is expensive. Once we have the public method `JsonObject.ConvertToJson` exposed, we can call the API directly to avoid a command invocation.
2019-01-23 10:39:12 -08:00
Travis Plunk c4b2105a73 Merged PR 6648: Bump SDK and Runtime Versions
Bump SDK and Runtime Versions
  - Also, fix alpine docker file
  - Also, fix extra files being added to some Modules after these changes
2019-01-23 02:18:44 +00:00
Aditya Patwardhan 9e8f5bde33 Merged PR 6644: Update hosting tests and metadata.json for 6.2.0-preview.4 release
Update hosting tests and metadata.json for 6.2.0-preview.4 release
2019-01-22 21:43:47 +00:00
xtqqczze 1df96c7ed5 Remove broken HelpUri from CimTest (#8688) 2019-01-22 11:21:45 -08:00
Mark Kraus 2dd549e34b Fix Code Page Parsing Isssue in Invoke-RestMethod (#8694) 2019-01-22 10:45:40 -08:00
Mark Kraus 67004aa224 Fix expect 100-continue Issue with Web Cmdlets (#8679)
Web Cmdlets will no longer forcibly remove Expect: 100-continue from web requests.
This was a legacy setting that needed to be there because of platform differences that have since been resolved in CoreFX.
2019-01-19 11:16:18 +05:00
Michael Klement 20919ee793 Allow 'name' as an alias key for 'label' in ConvertTo-Html, allow the 'width' entry to be an integer (#8426) 2019-01-18 11:02:22 -08:00
Mathias R. Jessen 59a3696f70 Allow user-specified underlying type for enums (#8329)
Fix #8028 

This change adds support for specifying the underlying type for an enum:

```powershell
enum MyEnum : long 
{
  A = 0x0FFFFFFFFFFFFFFF
  B
}
# or
enum MyByte : byte 
{
  A = 0x01
  B = 0x02
  C = 0x03
  D
}
```
2019-01-17 14:22:10 -08:00
Reece Dunham f29a04c1bd Remove appveyor environment checks (#8669) 2019-01-17 12:33:35 -08:00
Reece Dunham 41e63f6546 Create Support File (#8618) 2019-01-17 12:25:07 -08:00
Reece Dunham 9eb6fc927d docs(contributing): add link check information (#8659) 2019-01-16 15:30:55 -08:00
pougetat 4858afb613 Resolve :PAGER' if its path contains spaces (#8571) 2019-01-16 15:14:44 -08:00
PRASOON KARUNAN V 6b3e06893a Adding tests for PSDiagnostics Module (#8431) 2019-01-16 14:59:35 -08:00
Travis Plunk 03cd3a2548
Increase diagnosability of Link Checker failures (#8667)
Also use ThreadJobs for better perf
2019-01-16 14:28:10 -08:00
Ilya 782ef99465
Add support enum and char types in Format-Hex cmdlet (#8191) 2019-01-16 16:58:22 +05:00
Kirk Munro 41d9667307 Add -Stable to Sort-Object and related tests (#7862) 2019-01-15 17:14:39 -08:00
Sergey Vasin 279993bf39 Change Get-Help cmdlet -Parameter parameter so it accepts string arrays. (#8454) 2019-01-15 16:25:49 -08:00
Dongbo Wang c2dfae8ccb Fix 'FixupFileName' to not load resolved assembly during module discovery (#8634) 2019-01-15 16:22:25 -08:00
Travis Plunk 7bf4641444
Fix broken urls (#8653)
Fix broken URL
  - Also, move other static analysis tests into that CI.
  - Also, make the link analysis a pester test (partly to make sure the step fails in case of an error)
2019-01-15 16:20:45 -08:00
xtqqczze 6126624b63 Revise use of Start-Sleep cmdlet (#8633)
* Avoid use of sleep alias (follow-up to #8546)
* Specify default parameter name
* Shorten overly specific comments
2019-01-15 12:31:52 +05:00
Steve Lee c3cb6df809 Update 'CommandNotFound' fuzzy suggestion to only return unique results (#8640) 2019-01-14 14:28:15 -08:00
Jani 812456f84c Improve Start-Sleep cmdlet to accept fractional seconds (#8537) 2019-01-14 10:04:44 -08:00
Steve Lee 6fa5195589 Update fuzzy test to fix daily build (#8629) 2019-01-11 16:45:49 -08:00
Steve Lee 71e58f9439 Add the experimental feature 'PSUseAbbreviationExpansion' to support tab completion on abbreviated command names (#8109) 2019-01-10 16:11:43 -08:00
Steve Lee b87cd1c0a3 Add support to show suggestions on CommandNotFound exception (#8458)
* support fuzzy matching with get-command and on CommandNotFound exception, show suggestion
* fix CodeFactor issues
* change algorithm to use Damerau-Levenshtein Distance which is more useful in finding close matches
2019-01-10 13:35:30 -08:00
Steve Lee 9793ed2c68 Change hashtable to use OrdinalIgnoreCase to be case-insensitive in all Cultures (#8566)
Ubuntu18.04 seems to default to C.UTF-8 for LANG (representing InvariantCulture) which results in a case-sensitive hashtable since CurrentCultureIgnoreCase doesn't work for that culture. Fix is to use OrdinalIgnoreCase instead.
2019-01-10 09:11:43 +05:00
Kirk Munro 1729a682ee Make S.M.A.PowerShell.GetSteppablePipeline method public (#8055)
* make GetSteppablePipeline method public
* updated PowerShell member count
2019-01-09 15:31:09 -08:00
Ilya 6647b29f41
Fix LiteralPath in Import-Csv to bind to Get-ChildItem output (#8277)
Added new tests.
2019-01-09 18:49:15 +05:00
Michael Klement 73716e9792 Make scriptblock-based calculated properties work again in ConvertTo-Html (#8427) 2019-01-09 13:55:03 +05:00
Sergey Vasin 6f071f0ba5 Fix Join-String cmdlet FormatString parameter logic (#8449) 2019-01-09 11:06:20 +05:00
Steve Lee d6000fdea8 Allow Windows users in developer mode to create symlinks without elevation (#8534) 2019-01-08 10:43:24 -08:00
Steve Lee 64fcddcb53 Help function should only pass content to pager if content was found (#8528) 2019-01-08 09:56:56 -08:00
Steve Lee 031cbf0f16 Change clear-host to simply called [console]::clear and remove clear alias from Unix (#8603)
Based on @PowerShell/powershell-committee decision, standardizing on [Console]::Clear() on all platforms and removing clear alias on non-Windows.
2019-01-08 22:38:56 +05:00
Dongbo Wang 4a63201139 Remove 'en-us' from our doc links (#8602) 2019-01-07 17:11:17 -08:00
Steve Lee d51b5fdc30 help function shouldn't use pager for AliasHelpInfo (#8552) 2019-01-07 13:39:57 -08:00
Kirk Munro 23f6e8ff40 Add S.M.A.PowerShell.Create method overload with Runspace argument (#8057) 2019-01-07 11:04:42 -08:00
Ilya b8f9532b41 Style: Use the type alias 'string' instead of 'String' in places that are appropriate (#8573) 2019-01-07 10:46:00 -08:00
xtqqczze 379cbb60cd Correctly capitalize the ForEach operator in *.ps1 (#8583) 2019-01-06 17:00:56 +05:00
xtqqczze f0f301bc5e Avoid use of mkdir alias in *.ps1 and *.psm1 (#8582) 2019-01-04 14:31:24 +05:00
xtqqczze 1a3aadfc4e Regularize redirection operator spacing in *.ps1 and *.ps1m (#8581)
Add space after redirection operator.
2019-01-03 12:59:14 +05:00
Ilya dfd2f69369
Style: Change 'String.' to 'string.' (#8568) 2018-12-31 20:44:16 +05:00
Ilya f31750c0d1
Fix typo in AMSI test (#8561) 2018-12-29 18:16:50 +05:00
xtqqczze 70de294fea Remove use of cmdlet aliases from .\test\powershell (#8546) 2018-12-28 13:48:23 +05:00
xtqqczze b850d57c78 Style: Remove preceding spaces from C# preprocessor-type keywords (#8540) 2018-12-26 11:59:10 +05:00
Ilya d8af22c33b
Style: Change 'Byte{}' to 'byte[]' (#8525) 2018-12-24 11:23:18 +05:00
Steve Lee 4af3068566 Code cleanup: Add space after closing brace where needed (#8530)
* Update TestService

* Update WebListener

* Update Controllers

* Update ExpTest

* Update MyApp

* Update Logic

* Update Logic

* Update MyApp

* Update Microsoft.Management.Infrastructure.CimCmdlets

* Update Microsoft.PowerShell.Commands.Diagnostics

* Update Microsoft.PowerShell.ScheduledJob

* Update Microsoft.WSMan.Management

* Update Microsoft.WSMan.Runtime

* Update ResGen

* Update TypeCatalogGen

* Update commands

* Update Eventing

* Update Reader

* Update utility

* Update ShowCommand

* Update trace

* Update WebCmdlet

* Update Common

* Update CoreCLR

* Update common

* Update format-object

* Update format-wide

* Update out-file

* Update out-printer

* Update out-string

* Update OutGridView

* Update LocalAccounts

* Update Commands

* Update security

* Update CoreCLR

* Update DscSupport

* Update engine

* Update help

* Update logging

* Update namespaces

* Update security

* Update utils

* Update config

* Update perfCounters

* Update tracing

* Update cmdletization

* Update other

* Update cim

* Update xml

* Update CoreCLR

* Update common

* Update DefaultFormatters

* Update out-console

* Update out-textInterface

* Update DisplayDatabase

* Update Utilities

* Update COM

* Update ComInterop

* Update CommandCompletion

* Update debugger

* Update ExperimentalFeature

* Update hostifaces

* Update interpreter

* Update lang

* Update Modules

* Update parser

* Update runtime

* Update client

* Update commands

* Update common

* Update fanin

* Update server

* Update WireDataFormat

* Update Binding

* Update Operations

* Update interface

* Update cmdletization

* Update cim

* Update management

* Update WindowsTaskbarJumpList

* Update msh
2018-12-24 11:20:06 +05:00