mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-10 04:22:12 +00:00
[cli] Migrate Dev tests from ava to jest (#7822)
* Migrate ava cli dev tests to jest * remove outdated test * update tests * Update utils * update stdio to fix stalling * test stdio tests * add debug logs * more logs * use strip ansi * update * add exit flag and fix next dev test * update timeout for mac ci * update cancel * update cancel tests.yml -> test.yml * update other ids -> names * remove outdated test * de-dupe scripts * remove redwood dev test due to size
This commit is contained in:
@@ -76,7 +76,7 @@ async function nowDeploy(bodies, randomness, uploadNowJson) {
|
||||
}
|
||||
|
||||
logWithinTest('id', deploymentId);
|
||||
const st = expect.getState();
|
||||
const st = typeof expect !== 'undefined' ? expect.getState() : {};
|
||||
const expectstate = {
|
||||
currentTestName: st.currentTestName,
|
||||
testPath: st.testPath,
|
||||
@@ -170,8 +170,9 @@ async function deploymentGet(deploymentId) {
|
||||
}
|
||||
|
||||
let token;
|
||||
let currentCount = 0;
|
||||
const MAX_COUNT = 10;
|
||||
let tokenCreated = 0;
|
||||
// temporary tokens last for 25 minutes
|
||||
const MAX_TOKEN_AGE = 25 * 60 * 1000;
|
||||
|
||||
async function fetchWithAuth(url, opts = {}) {
|
||||
if (!opts.headers) opts.headers = {};
|
||||
@@ -189,9 +190,8 @@ async function fetchWithAuth(url, opts = {}) {
|
||||
}
|
||||
|
||||
async function fetchCachedToken() {
|
||||
currentCount += 1;
|
||||
if (!token || currentCount === MAX_COUNT) {
|
||||
currentCount = 0;
|
||||
if (!token || tokenCreated < Date.now() - MAX_TOKEN_AGE) {
|
||||
tokenCreated = Date.now();
|
||||
token = await fetchTokenWithRetry();
|
||||
}
|
||||
return token;
|
||||
|
||||
Reference in New Issue
Block a user