Skip to content

Commit 2f7a8ca

Browse files
committed
Add end-to-end Pester unit test
1 parent e4f9130 commit 2f7a8ca

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,5 +294,30 @@ 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("pester");
302+
string filePath = NewTestFile(@"
303+
Install-Module -Name Pester -Scope CurrentUser -Force | Import-Module -Force
304+
305+
Describe 'A' {
306+
Context 'B' {
307+
It 'C' {
308+
" + logStatement + @"
309+
}
310+
}
311+
}
312+
");
313+
314+
await PsesDebugAdapterClient.LaunchScript(filePath, Started).ConfigureAwait(false);
315+
316+
ConfigurationDoneResponse configDoneResponse = await PsesDebugAdapterClient.RequestConfigurationDone(new ConfigurationDoneArguments()).ConfigureAwait(false);
317+
Assert.NotNull(configDoneResponse);
318+
await Task.Delay(2000).ConfigureAwait(false);
319+
320+
Assert.Collection(GetLog(), (i) => Assert.Equal("pester", i));
321+
}
297322
}
298323
}

tools/azurePipelinesBuild.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if ($IsWindows -or $PSVersionTable.PSVersion.Major -lt 6) {
1616
# Update help needed for SignatureHelp LSP request.
1717
Update-Help -Force -ErrorAction SilentlyContinue
1818

19-
# Needed for build and docs gen.
19+
# Install build and test dependencies.
2020
Install-Module -Name InvokeBuild -RequiredVersion 5.9.7 -Scope CurrentUser -Force
2121
Install-Module -Name platyPS -RequiredVersion 0.14.2 -Scope CurrentUser -Force
2222

0 commit comments

Comments
 (0)