Fix flaky Cloudflare test (#8103)

* chore: fix flaky CF test

* chore: increase wrangler timeout
This commit is contained in:
Nate Moore 2023-08-16 13:28:57 -05:00 committed by GitHub
parent 79d35bbb90
commit 42ed85b3e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 8 deletions

View file

@ -31,10 +31,7 @@ describe('Cf metadata and caches', () => {
let html = await res.text();
let $ = cheerio.load(html);
expect($('#cf').text()).to.contain(
'city',
`Expected "city" to exist in runtime, but got ${$('#cf').text()}`
);
expect($('#hasRuntime').text()).to.equal('true');
expect($('#hasCache').text()).to.equal('true');
});
});

View file

@ -8,7 +8,7 @@ const runtime = getRuntime(Astro.request);
</head>
<body>
<h1>Testing</h1>
<div id="cf">{JSON.stringify(runtime.cf)}</div>
<div id="hasRuntime">{!!runtime.cf?.colo}</div>
<div id="hasCache">{!!runtime.caches}</div>
</body>
</html>

View file

@ -8,8 +8,8 @@ const env = runtime.env;
</head>
<body>
<h1>Testing</h1>
<div id="cf">{JSON.stringify(runtime.cf)}</div>
<div id="env">{JSON.stringify(env)}</div>
<div id="hasRuntime">{!!runtime.cf?.colo}</div>
<div id="hasCache">{!!runtime.caches}</div>
</body>
</html>

View file

@ -30,9 +30,9 @@ describe('Runtime Locals', () => {
expect(res.status).to.equal(200);
let html = await res.text();
let $ = cheerio.load(html);
expect($('#cf').text()).to.contain('city');
expect($('#env').text()).to.contain('SECRET_STUFF');
expect($('#env').text()).to.contain('secret');
expect($('#hasRuntime').text()).to.contain('true');
expect($('#hasCache').text()).to.equal('true');
});
});

View file

@ -48,7 +48,7 @@ export async function runCLI(basePath, { silent, port }) {
p.stderr.setEncoding('utf-8');
p.stdout.setEncoding('utf-8');
const timeout = 10_000;
const timeout = 20_000;
const ready = new Promise(async (resolve, reject) => {
const failed = setTimeout(() => {