Skip to content

Commit 6765616

Browse files
nohwndTylerLeonhardt
authored andcommitted
Run single test in Pester v5
1 parent 47d4563 commit 6765616

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/PowerShellEditorServices/Services/CodeLens/PesterCodeLensProvider.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ public PesterCodeLensProvider()
4242
/// <returns>All CodeLenses for the given Pester symbol.</returns>
4343
private CodeLens[] GetPesterLens(PesterSymbolReference pesterSymbol, ScriptFile scriptFile)
4444
{
45-
45+
var word = pesterSymbol.Command == PesterCommandType.It ? "test" : "tests";
4646
var codeLensResults = new CodeLens[]
4747
{
48+
4849
new CodeLens()
4950
{
5051
Range = pesterSymbol.ScriptRegion.ToRange(),
@@ -55,7 +56,7 @@ private CodeLens[] GetPesterLens(PesterSymbolReference pesterSymbol, ScriptFile
5556
Command = new Command()
5657
{
5758
Name = "PowerShell.RunPesterTests",
58-
Title = "Run tests",
59+
Title = $"Run {word}",
5960
Arguments = JArray.FromObject(new object[] {
6061
scriptFile.DocumentUri,
6162
false /* No debug */,
@@ -74,7 +75,7 @@ private CodeLens[] GetPesterLens(PesterSymbolReference pesterSymbol, ScriptFile
7475
Command = new Command()
7576
{
7677
Name = "PowerShell.RunPesterTests",
77-
Title = "Debug tests",
78+
Title = $"Debug {word}",
7879
Arguments = JArray.FromObject(new object[] {
7980
scriptFile.DocumentUri,
8081
true /* No debug */,
@@ -99,11 +100,6 @@ public CodeLens[] ProvideCodeLenses(ScriptFile scriptFile)
99100
{
100101
if (symbol is PesterSymbolReference pesterSymbol)
101102
{
102-
if (pesterSymbol.Command != PesterCommandType.Describe)
103-
{
104-
continue;
105-
}
106-
107103
lenses.AddRange(GetPesterLens(pesterSymbol, scriptFile));
108104
}
109105
}

0 commit comments

Comments
 (0)