Skip to content

Commit 4bb9108

Browse files
committed
Add end-to-end Pester unit test
1 parent 8738797 commit 4bb9108

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

.vsts-ci/templates/ci-general.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ steps:
88
displayName: PowerShell version
99
inputs:
1010
targetType: inline
11-
script: $PSVersionTable
11+
script: |
12+
$PSVersionTable
13+
Get-Module -ListAvailable Pester
1214
pwsh: ${{ parameters.pwsh }}
1315

1416
- task: UseDotNet@2

test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs

+27-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation.
1+
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

44
using System;
@@ -294,5 +294,31 @@ public async Task CanLaunchScriptWithCommentedLastLineAsync()
294294

295295
Assert.Collection(GetLog(), (i) => Assert.Equal("a log statement", i));
296296
}
297+
298+
[Fact]
299+
public async Task CanRunPesterTestFile()
300+
{
301+
string logStatement = GenerateScriptFromLoggingStatements("works");
302+
string filePath = NewTestFile(@"
303+
Describe 'A' {
304+
Context 'B' {
305+
It 'C' {
306+
throw 'error'
307+
}
308+
It 'D' {
309+
" + logStatement + @"
310+
}
311+
}
312+
}
313+
");
314+
315+
await PsesDebugAdapterClient.LaunchScript(filePath, Started).ConfigureAwait(false);
316+
317+
ConfigurationDoneResponse configDoneResponse = await PsesDebugAdapterClient.RequestConfigurationDone(new ConfigurationDoneArguments()).ConfigureAwait(false);
318+
Assert.NotNull(configDoneResponse);
319+
await Task.Delay(5000).ConfigureAwait(false);
320+
321+
Assert.Collection(GetLog(), (i) => Assert.Equal("works", i));
322+
}
297323
}
298324
}

0 commit comments

Comments
 (0)