[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:
JJ Kasper
2022-05-19 14:01:13 -05:00
committed by GitHub
parent 8d0c5114e4
commit 0f720472c4
56 changed files with 2044 additions and 13862 deletions

View File

@@ -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;