Skip to content

Commit dec80f6

Browse files
hectormmgCopilot
andcommitted
feat(e2e): pass compile-time suite flags into detect-changes script
The script now accepts -EnableBrowser/Node/React/Angular params (baked in by YAML compile-time expansion) and reports each suite's status clearly: msal-browser: skipped (disabled by parameter) msal-node: skipped (no affected changes) msal-react: will run ... This makes manual runs with some suites disabled self-documenting in logs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0729232 commit dec80f6

2 files changed

Lines changed: 46 additions & 5 deletions

File tree

.pipelines/3p-e2e.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ extends:
8080
inputs:
8181
targetType: filePath
8282
filePath: .pipelines/scripts/detect-changes.ps1
83+
arguments: >-
84+
-EnableBrowser "${{ parameters.runBrowserTests }}"
85+
-EnableNode "${{ parameters.runNodeTests }}"
86+
-EnableReact "${{ parameters.runReactTests }}"
87+
-EnableAngular "${{ parameters.runAngularTests }}"
8388
pwsh: true
8489

8590
- ${{ if eq(parameters.runBrowserTests, true) }}:

.pipelines/scripts/detect-changes.ps1

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,32 @@
33
# changes default all flags to true (fail-open).
44
#
55
# 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).
914

1015
param(
1116
[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"
1323
)
1424

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+
1532
$runBrowser = $runNode = $runReact = $runAngular = $run1p = $true
1633

1734
if ($env:SYSTEM_PULLREQUEST_TARGETBRANCH) {
@@ -63,7 +80,26 @@ if ($env:SYSTEM_PULLREQUEST_TARGETBRANCH) {
6380
Write-Host "Non-PR build — running all test suites"
6481
}
6582

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+
67103
Write-Host "##vso[task.setvariable variable=runMsalBrowser;isOutput=true]$($runBrowser.ToString().ToLower())"
68104
Write-Host "##vso[task.setvariable variable=runMsalNode;isOutput=true]$($runNode.ToString().ToLower())"
69105
Write-Host "##vso[task.setvariable variable=runMsalReact;isOutput=true]$($runReact.ToString().ToLower())"

0 commit comments

Comments
 (0)