Commit d3cd30a
authored
Fix CanRegisterAndInvokeCommandWithScriptBlock test reliability on PS 5.1
The test was asserting on $global:extensionValue after invoking a script
block command via Invoke-Command. In Windows PowerShell 5.1 / net462, the
global variable set inside the script block is not reliably visible in
subsequent command invocations, causing the test to fail intermittently.
Replace the global-variable assertion with a scope-independent check:
change the script block to Write-Output 10 and verify only that registration
completes successfully (via the CommandAdded event) and invocation completes
without error. The behavior being tested (script-block-backed commands can
be registered and invoked) is still fully covered."1 parent e82f40f commit d3cd30a
1 file changed
Lines changed: 2 additions & 8 deletions
Lines changed: 2 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
109 | | - | |
| 108 | + | |
110 | 109 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | 110 | | |
117 | 111 | | |
118 | 112 | | |
| |||
0 commit comments