diff options
author | 2023-07-17 20:30:02 +0800 | |
---|---|---|
committer | 2023-07-17 20:30:02 +0800 | |
commit | d69fe3a8d2e1c5d49fe08aa3d974fc37cee9ca93 (patch) | |
tree | 68204dbd11dca7d6a70e5139fecff5d05bc33823 /packages/integrations/cloudflare/test/cf.test.js | |
parent | 16af1709a57066a1cce443c1d769e7304ebd4101 (diff) | |
download | astro-d69fe3a8d2e1c5d49fe08aa3d974fc37cee9ca93.tar.gz astro-d69fe3a8d2e1c5d49fe08aa3d974fc37cee9ca93.tar.zst astro-d69fe3a8d2e1c5d49fe08aa3d974fc37cee9ca93.zip |
Handle flaky tests (#7651)
Diffstat (limited to 'packages/integrations/cloudflare/test/cf.test.js')
-rw-r--r-- | packages/integrations/cloudflare/test/cf.test.js | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/packages/integrations/cloudflare/test/cf.test.js b/packages/integrations/cloudflare/test/cf.test.js index cf310f34d..559df5c76 100644 --- a/packages/integrations/cloudflare/test/cf.test.js +++ b/packages/integrations/cloudflare/test/cf.test.js @@ -6,6 +6,8 @@ import cloudflare from '../dist/index.js'; describe('Cf metadata and caches', () => { /** @type {import('./test-utils').Fixture} */ let fixture; + /** @type {import('./test-utils').WranglerCLI} */ + let cli; before(async () => { fixture = await loadFixture({ @@ -14,22 +16,22 @@ describe('Cf metadata and caches', () => { adapter: cloudflare(), }); await fixture.build(); + + cli = runCLI('./fixtures/cf/', { silent: true, port: 8788 }); + await cli.ready; }); - it('Load cf and caches API', async () => { - const { ready, stop } = runCLI('./fixtures/cf/', { silent: true, port: 8788 }); + after(async () => { + await cli.stop(); + }); - try { - await ready; - let res = await fetch(`http://localhost:8788/`); - expect(res.status).to.equal(200); - let html = await res.text(); - let $ = cheerio.load(html); - // console.log($('#cf').text(), html); - expect($('#cf').text()).to.contain('city'); - expect($('#hasCache').text()).to.equal('true'); - } finally { - await stop(); - } + it('Load cf and caches API', async () => { + let res = await fetch(`http://localhost:8788/`); + expect(res.status).to.equal(200); + let html = await res.text(); + let $ = cheerio.load(html); + // console.log($('#cf').text(), html); + expect($('#cf').text()).to.contain('city'); + expect($('#hasCache').text()).to.equal('true'); }); }); |