fix(runner): filter args should respect trailing slash
This commit is contained in:
parent
1af4e367f4
commit
b3b7a7d224
|
|
@ -159,7 +159,7 @@ export function mergeObjects<A extends object, B extends object, C extends objec
|
|||
}
|
||||
|
||||
export function forceRegExp(pattern: string): RegExp {
|
||||
const match = pattern.match(/^\/(.*)\/([gi]*)$/);
|
||||
const match = pattern.match(/^\/(.*\/)([gi]*)$/);
|
||||
if (match)
|
||||
return new RegExp(match[1], match[2]);
|
||||
return new RegExp(pattern, 'gi');
|
||||
|
|
|
|||
|
|
@ -196,3 +196,28 @@ test('should focus a single test suite', async ({ runInlineTest }) => {
|
|||
expect(result.report.suites[0].suites[0].suites[0].specs[0].title).toEqual('pass2');
|
||||
expect(result.report.suites[0].suites[0].suites[0].specs[1].title).toEqual('pass3');
|
||||
});
|
||||
|
||||
test('should filter by folder with absolute path', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34813' } }, async ({ runInlineTest }) => {
|
||||
const result = await runInlineTest({
|
||||
'foo/x.spec.ts': `
|
||||
import { test, expect } from '@playwright/test';
|
||||
test('fails', () => { expect(1).toBe(2); });
|
||||
`,
|
||||
'foo/y.spec.ts': `
|
||||
import { test, expect } from '@playwright/test';
|
||||
test('fails', () => { expect(1).toBe(2); });
|
||||
`,
|
||||
'foobar/x.spec.ts': `
|
||||
import { test, expect } from '@playwright/test';
|
||||
test('fails', () => { expect(1).toBe(2); });
|
||||
`,
|
||||
'foobar/y.spec.ts': `
|
||||
import { test, expect } from '@playwright/test';
|
||||
test('fails', () => { expect(1).toBe(2); });
|
||||
`,
|
||||
}, undefined, undefined, { additionalArgs: [test.info().outputPath('foo') + '/'] });
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.failed).toBe(2);
|
||||
expect(result.output).toMatch(/foo[\\/]x.spec.ts/);
|
||||
expect(result.output).toMatch(/foo[\\/]y.spec.ts/);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue