From f386524f0b11e5f3defaf9eebd55ccbd95ba9e7f Mon Sep 17 00:00:00 2001 From: "Christoph Bergmeister [MVP]" Date: Mon, 11 Feb 2019 18:06:51 +0000 Subject: [PATCH] Handle Pester Describe block strings with single quotes inside it (#1729) (#1754) * Handle describe block strings with single quotes inside it. * fix replace call to handle expression with more than one single quote as well --- src/features/PesterTests.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/features/PesterTests.ts b/src/features/PesterTests.ts index 832e673a1d..ca950523cf 100644 --- a/src/features/PesterTests.ts +++ b/src/features/PesterTests.ts @@ -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}'`); }