diff options
Diffstat (limited to 'packages/integrations/cloudflare/test/with-solid-js.test.js')
-rw-r--r-- | packages/integrations/cloudflare/test/with-solid-js.test.js | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/packages/integrations/cloudflare/test/with-solid-js.test.js b/packages/integrations/cloudflare/test/with-solid-js.test.js index 501a947d0..dd097b700 100644 --- a/packages/integrations/cloudflare/test/with-solid-js.test.js +++ b/packages/integrations/cloudflare/test/with-solid-js.test.js @@ -1,38 +1,40 @@ -import { loadFixture, runCLI } from './test-utils.js'; -import { expect } from 'chai'; -import * as cheerio from 'cheerio'; +import { expect } from "chai"; +import * as cheerio from "cheerio"; +import { fileURLToPath } from "node:url"; +import { astroCli, wranglerCli } from "./_test-utils.js"; -describe('With SolidJS', () => { - /** @type {import('./test-utils').Fixture} */ - let fixture; - /** @type {import('./test-utils').WranglerCLI} */ - let cli; +const root = new URL("./fixtures/with-solid-js/", import.meta.url); - before(async function () { - fixture = await loadFixture({ - root: './fixtures/with-solid-js/', - }); - await fixture.build(); +describe("With SolidJS", () => { + let wrangler; + before(async () => { + await astroCli(fileURLToPath(root), "build"); - cli = await runCLI('./fixtures/with-solid-js/', { - silent: true, - onTimeout: (ex) => { - console.log(ex); - // if fail to start, skip for now as it's very flaky - this.skip(); - }, - }); - }); + wrangler = wranglerCli(fileURLToPath(root)); + await new Promise((resolve) => { + wrangler.stdout.on("data", (data) => { + console.log("[stdout]", data.toString()); + if (data.toString().includes("http://127.0.0.1:8788")) resolve(); + }); + wrangler.stderr.on("data", (data) => { + console.log("[stderr]", data.toString()); + }); + }); + }); - after(async () => { - await cli?.stop(); - }); + after((done) => { + wrangler.kill(); + setTimeout(() => { + console.log("CLEANED"); + done(); + }, 1000); + }); - it('renders the solid component', async () => { - let res = await fetch(`http://127.0.0.1:${cli.port}/`); - expect(res.status).to.equal(200); - let html = await res.text(); - let $ = cheerio.load(html); - expect($('.solid').text()).to.equal('Solid Content'); - }); + it("renders the solid component", async () => { + let res = await fetch(`http://127.0.0.1:8788/`); + expect(res.status).to.equal(200); + let html = await res.text(); + let $ = cheerio.load(html); + expect($(".solid").text()).to.equal("Solid Content"); + }); }); |