* Prettier formatting for ConvertTo-Json output. #2736
This change standardizes JSON output to example given, as well as
codemaid and online lint tools.
Sample object used for testing:
@{
foo = @{
first = 'a'
second = 'bbbbbbbb'
}
barbarbarbar = @{
first = 'a'
second = 'bbbbbbbb'
NestedArray = @(
'Test3'
'Test4'
'Test5'
3
4
)
NestedObject = @{
MoreObject = 'AnotherObject'
TestBool = $true
}
}
array = @(
'Thing1'
'Thing2'
)
dan = 15
} | ConvertTo-Json
* Updated CoreCLR implementation to use NewtonSoft Indented Formatting
I did not change the FullCLR behavior, I was not sure if you meant to
revert my changes or to leave it as is in the current pull request.
* Added tests that validate pretty Json output.
Not sure if there is a better thought on how to implement these. The
first two fail against current master, but succeed once this PR is
applied. Third test is successful prior and post this PR.
* Moved tests and removed extraneous file.
Moved pretty/compressed json tests from standalone file into the
existing ConvertTo-Json test file.
* Updated tests for cross-platform support
* Implement -version parameter in console host (address part of https://github.com/PowerShell/PowerShell/issues/1084)
This does not support providing a specific version to run, but
like most other *nix commands, -version will now return the version
of the PowerShell Engine. 'powershell' is prepended to the output to
match other *nix commands. We are using gitcommitid which includes more
info about the build.
* Changed broken link to a working blog post
"run-ps" isn't a linkable document, so I changed the "Running PowerShell Scripts Is as Easy as 1-2-3" to link to an external article on Windows IT Pro with the same name.
* Add ShouldProcess to New-FileCatalog and Test-FileCatalog
Close#3068
Add support `-WhatIf` and `-Confirm` to `New-FileCatalog` and add a
test.
`Test-FileCatalog` has a common code base with `New-FileCatalog` so it
automatically get the same. I believe that adding a separate test in
this case doesn't make sense.
* Fiz after code review
Remove _ShouldProcess
Add var in test
When a TypeTable is created it includes the types from type files provided along with references to the type files. When the InitialSessionState (ISS) object processes these types it reads the type files again and ends up with duplicate type entries. PowerShell V5.1 ISS type processing was re-written to improve performance and no longer removes duplicate types, so that this scenario (runspace ISS reuse) results in errors causing a regression.
The fix is to copy only type data when a TypeTable is passed to the ISS.
* Fix GetType() bad pattern and related issues in tests
$var.GetType() can raise an exception in tests so we should check $var
before make the call. A large part of the tests does not make this
check.
I start with searching ".GetType()" but discovered many related issues
in tests (reduntant and unneeded tests, "throw" bad pattens, bugs,
formattings (sorry!) and so on) - I had to fix them too.
* Fix after code review
* Second wave of migration GetType() -> BeOfType
Removed 'GetType().Name' patterns.
* Remove async tests for parser
this is a fix for https://github.com/PowerShell/PowerShell/issues/3069
This removes an attempt to work-around the issue of tests hanging on Travis-CI.
* remove unneeded finally block
* Improve console cmdlets tests
Main improvements refer to tests of the Write-Host cmdlet.
Original tests:
1. Slow because run external processes
2. Don't test colors and -NoNewLine in fact.
1. The original tests is preserved (deleted one as redundant) but marked
by 'Slow' tag. They is preserved because they actually check the output
on the work, not a test console.
2. Add negative color tests. (Code cover grow!)
3. Add tests based on TestHostCS. This test host has been refined so we
can see colors and a new line in output.
4. Add minor fixes for test modules loads.
Also I add support for Information stream. I originally planned to use
it but not actually used. However, I have left this as a useful addition
for future tests.
I wonder that a Write-Host console output is duplicated in Information
Stream - Is it by design? I left a debug print on this matter in the
test code.
* Fix after code review
* Corrections after code review
Suppress import-module warnings
Rename Describes
Add "-Object" test
Add Stream.Information tests with TestHostCS
* Add checks for Streams.Information and add comments
Interactive hosts expect an `IncompleteParseException` to signal that more input is expected.
When detecting errors, the parser can report 2 positions:
* where the error should be reported
* where the error was detected
Typically these are the same, so most error reporting methods have a single parameter.
For missing braces, the pattern is supposed to be to report the error after the opening brace, but the error is typically detected at the end of the file.
There were a few places where we were not consistent in reporting such errors, this PR corrects those places.
Native argument completers were not invoked when the argument was a single dash.
The fix is to treat unbound command parameters as command arguments for the purposes of parameter/argument completion.
* Make small optimization in parser tests
* Add Clear() for common command
Remove commands from AfterEach
* Refactoring test 'functions are resolved before cmdlets'
In rare cases, it was possible to cause high contention on a lock used
while compiling code to run in the interpreter.
This fixes the problem in a couple different ways:
* Use ConditionalWeakTable which has finer granularity in locking
* Avoid dictionary lookups in the most common cases
- There really aren't too many real cases, I could have covered them
all, but keeping the code generic is useful for the future.
Not quite related, but I noticed we didn't cache certain interpreter
instructions and it made sense to add a cache because we generate a lot
of array-init instructions.
* Adding PowerShellHelpFiles package which contains default.help.txt to powershell-win-core
* Adding test case to validate that <pshome>/<culture>/default.help.txt is present. This is done by calling 'Get-Help'
* Updating get-help to skip searching for the help file when the InternalTestHooks.BypassOnlineHelpRetrieval is enable. This way, we force get-help to generate a metadata driven help object, which includes a helpUri that points to the fwlink defined in the cmdlet code.
* Updating get-help -online <cmdletName> tests to not delete the help files. Instead, I've added logic to get-help to not find the help file when the test hook BypassOnlineHelpRetrieval is enable.
* changes which enable setting a badge for the daily test runs in travis
It updates an azure blob with an SVG and that location is referenced by the
README.md file. TravisCI doesn't support this directly so in order to report
on the status of a daily test run there, we need to do this.
Provide error reporting in case the badge can't be set
* change new-object calls to use constructor
Remove extraneous date setting
update string creation to use stringbuilder rather than string addition
* Corrected the opencover option to merge the output file
- Delete temporary zip file.
- Remove CodeCov uploading through cygwin.
- Add code to use Invoke-WebRequest to upload to CodeCov
* Codecov settings
- Wait for 1 build to start analysis.
- Do not wait for CI.
- Disable comments in PR.
* Addressed code review comments
* Fixing Invoke-WebRequest InFile parameter
* Adding aliases for Invoke-RestMethod and Invoke-WebRequest
* Adding test cases for Web cmdlets -InFile parameter
* Adding tests for Invoke-WebRequest (iwr) and Invoke-RestMethod (irm) using the cmdlet aliases.
* Remove the extra leading space
* Added functionality to improve failure triaging
- Nunit logs will be created to tests.
- Logs are copied to the Azure share.
- Pester is run with -Quiet
- Elevated and unelevated runs for tests with appropriate tags
* Copy logs to Azure share and upload to CodeCov
- Zip and copy to Azure log share
- Upload to codecov using cygwin
* Fixed varaible name in if condition
* Addressed code review comments
* Modified the destination folder structure for logs
- Creates a folder structure for yyyy-MM and Windows for storing logs
- Updated zip file name to not have illegal characters
* Modifications as suggested by codecov.io