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
)

* 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 8, 2019
1 parent f186c60 commit fc0d52b
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 fc0d52b

Please sign in to comment.