From fbc05b74a77e093033d5ab7b24e0a1346814f176 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Thu, 10 Feb 2022 07:02:37 -0800 Subject: [PATCH] chore: revert "fix(test-runner): escape backslashes in win cli (#11763)" (#12004) --- packages/playwright-test/src/cli.ts | 2 +- tests/playwright-test/command-line-filter.spec.ts | 9 --------- tests/playwright-test/test-ignore.spec.ts | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/packages/playwright-test/src/cli.ts b/packages/playwright-test/src/cli.ts index 28d48e1ff4..7f13dfe55d 100644 --- a/packages/playwright-test/src/cli.ts +++ b/packages/playwright-test/src/cli.ts @@ -181,7 +181,7 @@ function forceRegExp(pattern: string): RegExp { const match = pattern.match(/^\/(.*)\/([gi]*)$/); if (match) return new RegExp(match[1], match[2]); - return new RegExp(pattern.replace(/\\/g, '\\\\'), 'gi'); + return new RegExp(pattern, 'gi'); } function overridesFromOptions(options: { [key: string]: any }): Config { diff --git a/tests/playwright-test/command-line-filter.spec.ts b/tests/playwright-test/command-line-filter.spec.ts index 3a698a9cec..c0a9fe3e72 100644 --- a/tests/playwright-test/command-line-filter.spec.ts +++ b/tests/playwright-test/command-line-filter.spec.ts @@ -15,7 +15,6 @@ */ import { test, expect } from './playwright-test-fixtures'; -import path from 'path'; test('should filter by file name', async ({ runInlineTest }) => { const result = await runInlineTest({ @@ -94,14 +93,6 @@ test('should run nothing for missing line', async ({ runInlineTest }) => { expect(result.failed).toBe(1); }); -test('should escape path on windows', async ({ runInlineTest }) => { - const result = await runInlineTest({ - 'foo/test.spec.ts': `pwt.test('fails', () => { expect(1).toBe(2); });`, - }, undefined, undefined, { additionalArgs: [path.join('foo', 'test.spec.ts')] }); - expect(result.exitCode).toBe(1); - expect(result.failed).toBe(1); -}); - test('should focus a single nested test spec', async ({ runInlineTest }) => { const result = await runInlineTest({ 'foo.test.ts': ` diff --git a/tests/playwright-test/test-ignore.spec.ts b/tests/playwright-test/test-ignore.spec.ts index 049ba76a0e..2f72663118 100644 --- a/tests/playwright-test/test-ignore.spec.ts +++ b/tests/playwright-test/test-ignore.spec.ts @@ -185,7 +185,7 @@ test('should match cli string argument', async ({ runInlineTest }) => { const { test } = pwt; test('pass', ({}) => {}); ` - }, {}, {}, { additionalArgs: [`dir${path.sep}a`] }); + }, {}, {}, { additionalArgs: [`dir\\${path.sep}a`] }); expect(result.passed).toBe(1); expect(result.report.suites.map(s => s.file).sort()).toEqual(['a.test.ts']); expect(result.exitCode).toBe(0);