Skip to content

Commit

Permalink
Add end-to-end Pester unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
andyleejordan committed Jun 27, 2022
1 parent 8738797 commit d08b0cc
Showing 1 changed file with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
Expand Down Expand Up @@ -294,5 +294,31 @@ public async Task CanLaunchScriptWithCommentedLastLineAsync()

Assert.Collection(GetLog(), (i) => Assert.Equal("a log statement", i));
}

[Fact]
public async Task CanRunPesterTestFile()
{
string logStatement = GenerateScriptFromLoggingStatements("works");
string filePath = NewTestFile(@"
Describe 'A' {
Context 'B' {
It 'C' {
throw 'error'
}
It 'D' {
" + logStatement + @"
}
}
}
");

await PsesDebugAdapterClient.LaunchScript(filePath, Started).ConfigureAwait(false);

ConfigurationDoneResponse configDoneResponse = await PsesDebugAdapterClient.RequestConfigurationDone(new ConfigurationDoneArguments()).ConfigureAwait(false);
Assert.NotNull(configDoneResponse);
await Task.Delay(2000).ConfigureAwait(false);

Assert.Collection(GetLog(), (i) => Assert.Equal("works", i));
}
}
}

0 comments on commit d08b0cc

Please sign in to comment.