mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-13 17:14:02 +03:00
fix(test runner): dont mangle test names with multiple dashes (#10447)
This commit is contained in:
parent
da02c2e2c8
commit
20c0facfb9
@ -141,7 +141,7 @@ export function expectType(receiver: any, type: string, matcherName: string) {
|
||||
}
|
||||
|
||||
export function sanitizeForFilePath(s: string) {
|
||||
return s.replace(/[\x00-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+/g, '-');
|
||||
return s.replace(/[\x00-\x2C\x2E-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+/g, '-');
|
||||
}
|
||||
|
||||
export function addSuffixToFilePath(filePath: string, suffix: string, customExtension?: string, sanitize = false): string {
|
||||
|
@ -429,6 +429,19 @@ test('should allow nonAscii characters in the output dir', async ({ runInlineTes
|
||||
expect(outputDir).toBe(path.join(testInfo.outputDir, 'test-results', 'my-test-こんにちは世界'));
|
||||
});
|
||||
|
||||
test('should not mangle double dashes', async ({ runInlineTest }, testInfo) => {
|
||||
const result = await runInlineTest({
|
||||
'my--file.spec.js': `
|
||||
const { test } = pwt;
|
||||
test('my--test', async ({}, testInfo) => {
|
||||
console.log('\\n%%' + testInfo.outputDir);
|
||||
});
|
||||
`,
|
||||
});
|
||||
const outputDir = result.output.split('\n').filter(x => x.startsWith('%%'))[0].slice('%%'.length);
|
||||
expect(outputDir).toBe(path.join(testInfo.outputDir, 'test-results', 'my--file-my--test'));
|
||||
});
|
||||
|
||||
test('should allow include the describe name the output dir', async ({ runInlineTest }, testInfo) => {
|
||||
const result = await runInlineTest({
|
||||
'my-test.spec.js': `
|
||||
|
Loading…
Reference in New Issue
Block a user