update markdown tests (#7838)
update markdown tests - explicitly use gulp 4.0 beta because 3.9 depends on a vulnerable package
This commit is contained in:
parent
84634445ce
commit
8a0abf459c
|
@ -1344,10 +1344,12 @@ For more information on this, we invite you to read [this blog post explaining P
|
|||
Even if the module isn't owned by the PowerShell Team, please tell us what works and what doesn't by leaving a comment in [issue #4062][issue-4062]! (#3981)
|
||||
- Enhance type inference in tab completion based on runtime variable values. (#2744) (Thanks to @powercode!)
|
||||
This enables tab completion in situations like:
|
||||
|
||||
```powershell
|
||||
$p = Get-Process
|
||||
$p | Foreach-Object Prio<tab>
|
||||
```
|
||||
|
||||
- Add `GitCommitId` to PowerShell Core banner.
|
||||
Now you don't have to run `$PSVersionTable` as soon as you start PowerShell to get the version! (#3916) (Thanks to @iSazonov!)
|
||||
- Fix a bug in tab completion to make `native.exe --<tab>` call into native completer. (#3633) (Thanks to @powercode!)
|
||||
|
@ -1530,9 +1532,9 @@ We made a number of fixes to the progress bar rendering and the `ProgressRecord`
|
|||
- Add the `-TimeOut` parameter to `Test-Connection`. (#2492)
|
||||
- Add `ShouldProcess` support to `New-FileCatalog` and `Test-FileCatalog` (fixes `-WhatIf` and `-Confirm`). (#3074) (Thanks to @iSazonov!)
|
||||
- Fix `Test-ModuleManifest` to normalize paths correctly before validating.
|
||||
- This fixes some problems when using `Publish-Module` on non-Windows platforms. (#3097)
|
||||
- This fixes some problems when using `Publish-Module` on non-Windows platforms. (#3097)
|
||||
- Remove the `AliasProperty "Count"` defined for `System.Array`.
|
||||
- This removes the extraneous `Count` property on some `ConvertFrom-Json` output. (#3231) (Thanks to @PetSerAl!)
|
||||
- This removes the extraneous `Count` property on some `ConvertFrom-Json` output. (#3231) (Thanks to @PetSerAl!)
|
||||
- Port `Import-PowerShellDatafile` from PowerShell script to C#. (#2750) (Thanks to @powercode!)
|
||||
- Add `-CustomMethod` parameter to web cmdlets to allow for non-standard method verbs. (#3142) (Thanks to @Lee303!)
|
||||
- Fix web cmdlets to include the HTTP response in the exception when the response status code is not success. (#3201)
|
||||
|
|
|
@ -186,16 +186,19 @@ If you copy `netstandard.dll` from this directory to the directory containing
|
|||
get it to reload `MyModule.dll`.
|
||||
|
||||
1. Copy the `netstandard.dll` implementation assembly for .NET 4.6.1 to the module's directory.
|
||||
|
||||
```powershell
|
||||
cd 'path-to-where-you-copied-module.dll'
|
||||
Copy-Item 'C:\Program Files\dotnet\sdk\<version-number>\Microsoft\Microsoft.NET.Build.Extensions\net461\lib\netstandard.dll' .
|
||||
```
|
||||
|
||||
1. Import the module and execute the command:
|
||||
|
||||
```powershell
|
||||
Import-Module .\MyModule.dll
|
||||
Write-TimestampedMessage "Test message."
|
||||
```
|
||||
|
||||
Now the command should succeed.
|
||||
|
||||
Note: If it fails, restart Windows PowerShell to make sure
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
|
||||
- Use `Squash and merge` by default to keep clean commit history in Master branch.
|
||||
|
||||
![](./Images/squash-merge.png) ![](./Images/squash-confirm.png)
|
||||
![Squash Merge Example](./Images/squash-merge.png) ![Squash Confirm Example](./Images/squash-confirm.png)
|
||||
|
||||
- Use `Create a merge commit` for feature-work PRs **only if** the commit history of the PR is reasonably clean.
|
||||
After using this option, GitHub will make it your default option for merging a PR.
|
||||
Do remember to change the default back to `Squash and merge`.
|
||||
|
||||
![](./Images/merge-commit.png) ![](./Images/merge-commit-confirm.png)
|
||||
![Merge Commit Example](./Images/merge-commit.png) ![Merge Confirm Example](./Images/merge-commit-confirm.png)
|
||||
|
||||
- Avoid `Rebase and merge` unless you have a strong argument for using it.
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.9.0" />
|
||||
<PackageReference Include="NJsonSchema" Version="9.10.74" />
|
||||
<PackageReference Include="NJsonSchema" Version="9.10.75" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -47,7 +47,7 @@ function RunTest() {
|
|||
function callback(err, result) {
|
||||
var resultString = (result || "").toString();
|
||||
if (resultString) {
|
||||
file.contents = new Buffer(resultString);
|
||||
file.contents = Buffer.from(resultString);
|
||||
}
|
||||
next(err, file);
|
||||
});
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
Import-Module HelpersCommon
|
||||
$moduleRootFilePath = Split-Path -Path $PSScriptRoot -Parent
|
||||
|
||||
# Identify the repository root path of the resource module
|
||||
|
@ -25,7 +27,7 @@ Describe 'Common Tests - Validate Markdown Files' -Tag 'CI' {
|
|||
-NoNewWindow
|
||||
Start-Process `
|
||||
-FilePath "npm" `
|
||||
-ArgumentList @('install','-g','gulp','--silent') `
|
||||
-ArgumentList @('install','-g','gulp@4.0.0','--silent') `
|
||||
-Wait `
|
||||
-WorkingDirectory $PSScriptRoot `
|
||||
-NoNewWindow
|
||||
|
@ -40,6 +42,9 @@ Describe 'Common Tests - Validate Markdown Files' -Tag 'CI' {
|
|||
Write-Warning "Node and npm are required to run this test"
|
||||
$skip = $true
|
||||
}
|
||||
|
||||
$mdIssuesPath = Join-Path -Path $PSScriptRoot -ChildPath "markdownissues.txt"
|
||||
Remove-Item -Path $mdIssuesPath -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,30 +93,23 @@ Describe 'Common Tests - Validate Markdown Files' -Tag 'CI' {
|
|||
'./tools/*.md'
|
||||
)
|
||||
$filter = ($docsToTest -join ',')
|
||||
&"gulp" test-mdsyntax --silent `
|
||||
--rootpath $repoRootPath `
|
||||
--filter $filter
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Warning -Message ("Unable to run gulp to test markdown files. Please " + `
|
||||
"be sure that you have installed nodejs and have " + `
|
||||
"run 'npm install -g gulp' in order to have this " + `
|
||||
"text execute.")
|
||||
# Gulp 4 beta is returning non-zero exit code even when there is not an error
|
||||
Start-NativeExecution {
|
||||
&"gulp" test-mdsyntax --silent `
|
||||
--rootpath $repoRootPath `
|
||||
--filter $filter
|
||||
} -VerboseOutputOnError -IgnoreExitcode
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
$LASTEXITCODE | Should beexactly 0
|
||||
$mdIssuesPath | Should -Exist
|
||||
|
||||
$mdIssuesPath = Join-Path -Path $PSScriptRoot -ChildPath "markdownissues.txt"
|
||||
|
||||
$mdIssuesPath | should exist
|
||||
|
||||
[string] $markdownErrors = Get-Content -Path $mdIssuesPath
|
||||
[string[]] $markdownErrors = Get-Content -Path $mdIssuesPath
|
||||
Remove-Item -Path $mdIssuesPath -Force -ErrorAction SilentlyContinue
|
||||
|
||||
if ($markdownErrors -ne "--EMPTY--")
|
||||
|
@ -119,6 +117,6 @@ Describe 'Common Tests - Validate Markdown Files' -Tag 'CI' {
|
|||
$markdownErrors += ' (See https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md for an explanation of the error codes)'
|
||||
}
|
||||
|
||||
$markdownErrors | Should BeExactly "--EMPTY--"
|
||||
$markdownErrors -join "`n" | Should -BeExactly "--EMPTY--"
|
||||
}
|
||||
}
|
||||
|
|
3686
test/common/markdown/package-lock.json
generated
3686
test/common/markdown/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -4,14 +4,13 @@
|
|||
"description": "The PowerShell Common MarkDown Tests.",
|
||||
"main": "gulpfile.js",
|
||||
"dependencies": {
|
||||
"gulp": "^3.9.1",
|
||||
"through2": "^2.0.1",
|
||||
"markdownlint": "^0.2.0"
|
||||
"gulp": "^4.0.0",
|
||||
"markdownlint": "^0.11.0",
|
||||
"through2": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp-concat": "^2.6.1",
|
||||
"gulp-debug": "^3.0.0",
|
||||
"markdownlint": "^0.4.0"
|
||||
"gulp-debug": "^3.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -23,6 +23,7 @@ FunctionsToExport = @(
|
|||
'Get-RandomFileName'
|
||||
'Send-VstsLogFile'
|
||||
'Set-TesthookResult'
|
||||
'Start-NativeExecution'
|
||||
'Test-IsElevated'
|
||||
'Test-IsRoot'
|
||||
'Test-IsVstsLinux'
|
||||
|
|
|
@ -266,3 +266,50 @@ function Test-IsVstsWindows
|
|||
{
|
||||
return ($env:TF_BUILD -and $IsWindows)
|
||||
}
|
||||
|
||||
# this function wraps native command Execution
|
||||
# for more information, read https://mnaoumov.wordpress.com/2015/01/11/execution-of-external-commands-in-powershell-done-right/
|
||||
function Start-NativeExecution
|
||||
{
|
||||
param(
|
||||
[scriptblock]$sb,
|
||||
[switch]$IgnoreExitcode,
|
||||
[switch]$VerboseOutputOnError
|
||||
)
|
||||
$backupEAP = $script:ErrorActionPreference
|
||||
$script:ErrorActionPreference = "Continue"
|
||||
try {
|
||||
if($VerboseOutputOnError.IsPresent)
|
||||
{
|
||||
$output = & $sb 2>&1
|
||||
}
|
||||
else
|
||||
{
|
||||
& $sb
|
||||
}
|
||||
|
||||
# note, if $sb doesn't have a native invocation, $LASTEXITCODE will
|
||||
# point to the obsolete value
|
||||
if ($LASTEXITCODE -ne 0 -and -not $IgnoreExitcode) {
|
||||
if($VerboseOutputOnError.IsPresent -and $output)
|
||||
{
|
||||
$output | Out-String | Write-Verbose -Verbose
|
||||
}
|
||||
|
||||
# Get caller location for easier debugging
|
||||
$caller = Get-PSCallStack -ErrorAction SilentlyContinue
|
||||
if($caller)
|
||||
{
|
||||
$callerLocationParts = $caller[1].Location -split ":\s*line\s*"
|
||||
$callerFile = $callerLocationParts[0]
|
||||
$callerLine = $callerLocationParts[1]
|
||||
|
||||
$errorMessage = "Execution of {$sb} by ${callerFile}: line $callerLine failed with exit code $LASTEXITCODE"
|
||||
throw $errorMessage
|
||||
}
|
||||
throw "Execution of {$sb} failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
} finally {
|
||||
$script:ErrorActionPreference = $backupEAP
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue