Iterate
This commit is contained in:
@@ -70,8 +70,7 @@ export const expect = baseExpect.extend<Expectations>({
|
|||||||
testInfo.annotations.push({
|
testInfo.annotations.push({
|
||||||
// `_` prefix hides it from the HTML reporter
|
// `_` prefix hides it from the HTML reporter
|
||||||
type: "_screenshot",
|
type: "_screenshot",
|
||||||
// include a path relative to `playwright/snapshots/`
|
description: testInfo.snapshotPath(screenshotName),
|
||||||
description: testInfo.snapshotPath(screenshotName).split("/playwright/snapshots/", 2)[1],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return { pass: true, message: (): string => "", name: "toMatchScreenshot" };
|
return { pass: true, message: (): string => "", name: "toMatchScreenshot" };
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ Please see LICENSE files in the repository root for full details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { glob } from "glob";
|
import { glob } from "glob";
|
||||||
|
import path from "node:path";
|
||||||
import { type Reporter, type TestCase } from "@playwright/test/reporter";
|
import { type Reporter, type TestCase } from "@playwright/test/reporter";
|
||||||
import { type FullConfig } from "@playwright/test";
|
import { type FullConfig } from "@playwright/test";
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ class StaleScreenshotReporter implements Reporter {
|
|||||||
for (const snapshotRoot of this.snapshotRoots) {
|
for (const snapshotRoot of this.snapshotRoots) {
|
||||||
const files = await glob(`**/*.png`, { cwd: snapshotRoot });
|
const files = await glob(`**/*.png`, { cwd: snapshotRoot });
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
screenshotFiles.add(file);
|
screenshotFiles.add(path.join(snapshotRoot, file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user