Skip to content

Commit 04434ed

Browse files
danadajianclaude
andauthored
fix(action): Detect misconfigured screenshots-directory and fail with a clear error (#772)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: danadajian <danadajian@users.noreply.github.com>
1 parent 2ab4585 commit 04434ed

4 files changed

Lines changed: 75 additions & 34 deletions

File tree

action/dist/main.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162965,6 +162965,15 @@ var run = async () => {
162965162965
const numVisualTestFailures = visualTestExitCodes.filter((code) => code !== 0).length;
162966162966
const screenshotsDirectory = getInput("screenshots-directory");
162967162967
const screenshotsPath = path5.join(process.cwd(), screenshotsDirectory);
162968+
const orphanedNewPngs = await Ze(`**/screenshots/**/new.png`, {
162969+
cwd: process.cwd(),
162970+
absolute: true,
162971+
ignore: ["**/node_modules/**", `${screenshotsPath}/**`]
162972+
});
162973+
if (orphanedNewPngs.length > 0) {
162974+
setFailed(`Screenshots were found outside the configured screenshots-directory ("${screenshotsDirectory}"): ${orphanedNewPngs.join(", ")}. Check that your screenshots-directory input points to where Cypress writes screenshots.`);
162975+
return;
162976+
}
162968162977
const filesInScreenshotDirectory = await Ze(`${screenshotsPath}/**/{base,diff,new}.png`, {
162969162978
absolute: false
162970162979
});
@@ -163069,5 +163078,5 @@ var run = async () => {
163069163078
// src/main.ts
163070163079
run();
163071163080

163072-
//# debugId=141C88A46CB6980E64756E2164756E21
163081+
//# debugId=75BCFBE38D00837064756E2164756E21
163073163082
//# sourceMappingURL=main.js.map

0 commit comments

Comments
 (0)