mirror of
				https://github.com/microsoft/playwright.git
				synced 2025-06-26 21:40:17 +00:00 
			
		
		
		
	fix: do not create empty directories for successful snapshot tests (#24127)
Fixes https://github.com/microsoft/playwright/issues/15600
This commit is contained in:
		
							parent
							
								
									19474bef78
								
							
						
					
					
						commit
						94d6b1210b
					
				@ -124,8 +124,8 @@ class SnapshotHelper<T extends ImageComparatorOptions> {
 | 
			
		||||
    const inputPathSegments = Array.isArray(name) ? name : [addSuffixToFilePath(name, '', undefined, true)];
 | 
			
		||||
    const outputPathSegments = Array.isArray(name) ? name : [addSuffixToFilePath(name, actualModifier, undefined, true)];
 | 
			
		||||
    this.snapshotPath = snapshotPathResolver(...inputPathSegments);
 | 
			
		||||
    const inputFile = testInfo.outputPath(...inputPathSegments);
 | 
			
		||||
    const outputFile = testInfo.outputPath(...outputPathSegments);
 | 
			
		||||
    const inputFile = testInfo._getOutputPath(...inputPathSegments);
 | 
			
		||||
    const outputFile = testInfo._getOutputPath(...outputPathSegments);
 | 
			
		||||
    this.expectedPath = addSuffixToFilePath(inputFile, '-expected');
 | 
			
		||||
    this.previousPath = addSuffixToFilePath(outputFile, '-previous');
 | 
			
		||||
    this.actualPath = addSuffixToFilePath(outputFile, '-actual');
 | 
			
		||||
 | 
			
		||||
@ -382,7 +382,12 @@ export class TestInfoImpl implements TestInfo {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  outputPath(...pathSegments: string[]){
 | 
			
		||||
    const outputPath = this._getOutputPath(...pathSegments);
 | 
			
		||||
    fs.mkdirSync(this.outputDir, { recursive: true });
 | 
			
		||||
    return outputPath;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  _getOutputPath(...pathSegments: string[]){
 | 
			
		||||
    const joinedPath = path.join(...pathSegments);
 | 
			
		||||
    const outputPath = getContainedPath(this.outputDir, joinedPath);
 | 
			
		||||
    if (outputPath)
 | 
			
		||||
 | 
			
		||||
@ -283,6 +283,7 @@ test('should support clip option for page', async ({ runInlineTest }, testInfo)
 | 
			
		||||
      });
 | 
			
		||||
    `
 | 
			
		||||
  });
 | 
			
		||||
  expect(fs.existsSync(testInfo.outputPath('test-results', 'a-is-a-test'))).toBe(false);
 | 
			
		||||
  expect(result.exitCode).toBe(0);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user