|
3 | 3 | # changes default all flags to true (fail-open). |
4 | 4 | # |
5 | 5 | # Parameters: |
6 | | -# -Repo3pPath Path to the 3P repo root. Defaults to the current directory. |
7 | | -# -Repo1pPath Path to the 1P repo root. Optional; provide when the 1P repo |
8 | | -# is checked out (i.e. in 1p-e2e.yml) to also gate msal-browser-1p. |
| 6 | +# -Repo3pPath Path to the 3P repo root. Defaults to the current directory. |
| 7 | +# -Repo1pPath Path to the 1P repo root. Optional; provide when the 1P repo |
| 8 | +# is checked out (i.e. in 1p-e2e.yml) to also gate msal-browser-1p. |
| 9 | +# -EnableBrowser Whether msal-browser tests are enabled at all (compile-time param). |
| 10 | +# -EnableNode Whether msal-node tests are enabled at all (compile-time param). |
| 11 | +# -EnableReact Whether msal-react tests are enabled at all (compile-time param). |
| 12 | +# -EnableAngular Whether msal-angular tests are enabled at all (compile-time param). |
| 13 | +# -Enable1p Whether msal-browser-1p tests are enabled at all (compile-time param). |
9 | 14 |
|
10 | 15 | param( |
11 | 16 | [string]$Repo3pPath = $PWD, |
12 | | - [string]$Repo1pPath = "" |
| 17 | + [string]$Repo1pPath = "", |
| 18 | + [string]$EnableBrowser = "true", |
| 19 | + [string]$EnableNode = "true", |
| 20 | + [string]$EnableReact = "true", |
| 21 | + [string]$EnableAngular = "true", |
| 22 | + [string]$Enable1p = "true" |
13 | 23 | ) |
14 | 24 |
|
| 25 | +# Convert string flags passed from YAML compile-time expansion to booleans |
| 26 | +$enabledBrowser = $EnableBrowser -ne "false" |
| 27 | +$enabledNode = $EnableNode -ne "false" |
| 28 | +$enabledReact = $EnableReact -ne "false" |
| 29 | +$enabledAngular = $EnableAngular -ne "false" |
| 30 | +$enabled1p = $Enable1p -ne "false" |
| 31 | + |
15 | 32 | $runBrowser = $runNode = $runReact = $runAngular = $run1p = $true |
16 | 33 |
|
17 | 34 | if ($env:SYSTEM_PULLREQUEST_TARGETBRANCH) { |
@@ -63,7 +80,26 @@ if ($env:SYSTEM_PULLREQUEST_TARGETBRANCH) { |
63 | 80 | Write-Host "Non-PR build — running all test suites" |
64 | 81 | } |
65 | 82 |
|
66 | | -Write-Host "Run: browser=$runBrowser node=$runNode react=$runReact angular=$runAngular browser-1p=$run1p" |
| 83 | +# AND detection result with compile-time enabled flags and report reason |
| 84 | +function Report-Suite([string]$name, [bool]$detected, [bool]$enabled) { |
| 85 | + if (-not $enabled) { Write-Host " $name`: skipped (disabled by parameter)" } |
| 86 | + elseif (-not $detected) { Write-Host " $name`: skipped (no affected changes)" } |
| 87 | + else { Write-Host " $name`: will run" } |
| 88 | +} |
| 89 | + |
| 90 | +Write-Host "Suite status:" |
| 91 | +Report-Suite "msal-browser" $runBrowser $enabledBrowser |
| 92 | +Report-Suite "msal-node" $runNode $enabledNode |
| 93 | +Report-Suite "msal-react" $runReact $enabledReact |
| 94 | +Report-Suite "msal-angular" $runAngular $enabledAngular |
| 95 | +Report-Suite "msal-browser-1p" $run1p $enabled1p |
| 96 | + |
| 97 | +$runBrowser = $runBrowser -and $enabledBrowser |
| 98 | +$runNode = $runNode -and $enabledNode |
| 99 | +$runReact = $runReact -and $enabledReact |
| 100 | +$runAngular = $runAngular -and $enabledAngular |
| 101 | +$run1p = $run1p -and $enabled1p |
| 102 | + |
67 | 103 | Write-Host "##vso[task.setvariable variable=runMsalBrowser;isOutput=true]$($runBrowser.ToString().ToLower())" |
68 | 104 | Write-Host "##vso[task.setvariable variable=runMsalNode;isOutput=true]$($runNode.ToString().ToLower())" |
69 | 105 | Write-Host "##vso[task.setvariable variable=runMsalReact;isOutput=true]$($runReact.ToString().ToLower())" |
|
0 commit comments