Skip to content

Single quotes inside Pester test names prevent tests from running #1725

Closed
@sobjornstad

Description

@sobjornstad

Issue Description

The "Run Tests" or "Debug Tests" option appearing above Pester Describe blocks does not work when the string contains a single quote. vscode-powershell appears to be neglecting to escape them when issuing a shell command to run the tests.

Describe "This test works" {
    It "follows the basic principles of logic" {
        $true | should be $true
    }
}

Describe "This test's broken" {
    It "follows the basic principles of logic" {
        $true | should be $true
    }
}

Working test yields:

Describing This test works
 [+] follows the basic principles of logic 56ms
Tests completed in 56ms
Passed: 1 Failed: 0 Skipped: 0 Pending: 0 Inconclusive: 0

And broken test:

The string is missing the terminator: '.
At line:0 char:0

I'm still using version 3.4.0 of Pester, if that matters. The tests run fine when I call Invoke-Pester in the console.

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.15063
VSCode 1.30.2
PowerShell Extension Version 1.10.2

PowerShell Information

Name Value
PSVersion 5.1.15063.1563
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.15063.1563
BuildVersion 10.0.15063.1563
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
PowerShell ms-vscode 1.10.2

(All other extensions manually disabled to confirm no interference)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions