Skip to content

Commit 28c2aa5

Browse files
committed
fix(visual-regressions): fetch base branch to sync local and remote
1 parent f528236 commit 28c2aa5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

core/scripts/testing/e2e-script.mjs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,28 @@ async function main() {
9292
baseBranch = defaultBaseBranch;
9393
}
9494

95+
/**
96+
* The provided base branch needs to be fetched.
97+
* This ensures that the local base branch is up-to-date with the
98+
* remote base branch. Otherwise, there might be errors stating that
99+
* certain files don't exist in the local base branch.
100+
*/
101+
const fetchBaseBranch = spinner();
102+
103+
// Inform the user that the base branch is being fetched.
104+
fetchBaseBranch.start(`Fetching "${baseBranch}" to have the latest changes`);
105+
106+
// Fetch the base branch.
107+
await execAsync(`git fetch origin ${baseBranch}`).catch((error) => {
108+
fetchBaseBranch.stop(`Failed to fetch "${baseBranch}"`);
109+
console.error(error);
110+
return process.exit(0);
111+
});
112+
113+
// Inform the user that the base branch has been fetched.
114+
fetchBaseBranch.stop(`Fetched "${baseBranch}"`);
115+
116+
95117
const updateGroundTruth = spinner();
96118

97119
// Inform the user that the local ground truths are being updated.

0 commit comments

Comments
 (0)