Skip to content

Commit fc0d52b

Browse files
bergmeisterTylerLeonhardt
authored andcommitted
Handle Pester Describe block strings with single quotes inside it (#1729)
* Handle describe block strings with single quotes inside it. * fix replace call to handle expression with more than one single quote as well
1 parent f186c60 commit fc0d52b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: src/features/PesterTests.ts

+4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ export class PesterTestsFeature implements IFeature {
7272

7373
if (describeBlockName) {
7474
launchConfig.args.push("-TestName");
75+
// Escape single quotes inside double quotes by doubling them up
76+
if (describeBlockName.includes("'")) {
77+
describeBlockName = describeBlockName.replace(/'/g, "''");
78+
}
7579
launchConfig.args.push(`'${describeBlockName}'`);
7680
}
7781

0 commit comments

Comments
 (0)