mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-10 04:22:12 +00:00
[tests] set retry count to 0 when running tests locally (#8529)
When running tests locally that fail to make a fetch request, the retries add a lot of noise to debugging. This PR sets those retry counts to `0` locally, but keeps them at their current value for CI.
This commit is contained in:
@@ -13,6 +13,7 @@ const {
|
|||||||
|
|
||||||
jest.setTimeout(6 * 60 * 1000);
|
jest.setTimeout(6 * 60 * 1000);
|
||||||
|
|
||||||
|
const isCI = !!process.env.CI;
|
||||||
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
|
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
|
||||||
const isCanary = () => getDistTag(cliVersion) === 'canary';
|
const isCanary = () => getDistTag(cliVersion) === 'canary';
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@ function fetchWithRetry(url, opts = {}) {
|
|||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
retries: opts.retries || 3,
|
retries: opts.retries ?? 3,
|
||||||
factor: 1,
|
factor: 1,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -150,9 +151,9 @@ async function testPath(
|
|||||||
fetchOpts = {}
|
fetchOpts = {}
|
||||||
) {
|
) {
|
||||||
const opts = {
|
const opts = {
|
||||||
|
retries: isCI ? 5 : 0,
|
||||||
...fetchOpts,
|
...fetchOpts,
|
||||||
redirect: 'manual-dont-change',
|
redirect: 'manual-dont-change',
|
||||||
retries: 5,
|
|
||||||
status,
|
status,
|
||||||
};
|
};
|
||||||
const url = `${origin}${path}`;
|
const url = `${origin}${path}`;
|
||||||
@@ -330,7 +331,7 @@ function testFixtureStdio(
|
|||||||
Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
},
|
},
|
||||||
body: JSON.stringify(projectSettings),
|
body: JSON.stringify(projectSettings),
|
||||||
retries: 3,
|
retries: isCI ? 3 : 0,
|
||||||
status: 200,
|
status: 200,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user