Skip to content

Commit

Permalink
Handle Pester Describe block strings with single quotes inside it (#1729
Browse files Browse the repository at this point in the history
) (#1754)

* Handle describe block strings with single quotes inside it.

* fix replace call to handle expression with more than one single quote as well
  • Loading branch information
bergmeister authored and TylerLeonhardt committed Feb 11, 2019
1 parent 07c52b9 commit f386524
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/features/PesterTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export class PesterTestsFeature implements IFeature {

if (describeBlockName) {
launchConfig.args.push("-TestName");
// Escape single quotes inside double quotes by doubling them up
if (describeBlockName.includes("'")) {
describeBlockName = describeBlockName.replace(/'/g, "''");
}
launchConfig.args.push(`'${describeBlockName}'`);
}

Expand Down

0 comments on commit f386524

Please sign in to comment.