Skip to content

Commit 19d527d

Browse files
committed
feat: change to test case to retry 3 times upon EACCES error code
1 parent 1031440 commit 19d527d

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

test/e2e/api.test.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -679,10 +679,21 @@ describe("API", () => {
679679
expect(pageErrors).toMatchSnapshot("page errors");
680680
} catch (error) {
681681
if (error.code === "EACCES") {
682-
console.warn(
683-
`Skipping test due to permission issues: ${error.message}`,
684-
);
685-
return;
682+
// Retry mechanism for EACCES errors
683+
const maxRetries = 3;
684+
const retryKey = `retry_${expect.getState().currentTestName}`;
685+
686+
// Get current retry count or initialize to 0
687+
global[retryKey] = global[retryKey] || 0;
688+
global[retryKey] += 1;
689+
690+
if (global[retryKey] < maxRetries) {
691+
console.warn(
692+
`EACCES error encountered (attempt ${global[retryKey]}/${maxRetries}): ${error.message}. Retrying...`,
693+
);
694+
// Re-run the current test
695+
return it.currentTest.fn();
696+
}
686697
}
687698
throw error;
688699
} finally {

0 commit comments

Comments
 (0)