The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
| 1 | import * as GCP from "@alchemy.run/gcp"; |
| 2 | import { describe, expect } from "@alchemy.run/test"; |
| 3 | import * as Test from "@alchemy.run/test/Alchemy"; |
| 4 | import * as Effect from "effect/Effect"; |
| 5 | import * as pathe from "pathe"; |
| 6 | import { cloneFixture } from "../../Cloudflare/Utils/Fixture.ts"; |
| 7 | import { expectUrlContains } from "../../Cloudflare/Utils/Http.ts"; |
| 8 | |
| 9 | const { test } = Test.make({ providers: GCP.providers(), dev: true }); |
| 10 | |
| 11 | const fixtureDir = pathe.resolve( |
| 12 | import.meta.dirname, |
| 13 | "../../../../../examples/cloudflare-website-vocs", |
| 14 | ); |
| 15 | const tempRoot = pathe.resolve(import.meta.dirname, "../../../.tmp"); |
| 16 | const fixtureEntries = ["package.json", "public", "src", "tsconfig.json", "vocs.config.ts"]; |
| 17 | |
| 18 | describe( |
| 19 | "GCP.Website.Vocs local", |
| 20 | { tags: ["provider:gcp", "provider:gcp:website", "local"] }, |
| 21 | () => { |
| 22 | // Vocs' vite plugin reads `src/pages` from process.cwd() rather than |
| 23 | // the project `root`, so alchemy-test (cwd = packages/alchemy) cannot |
| 24 | // host the cloned fixture. Cloudflare.Website.Vocs local uses the |
| 25 | // Worker source provider instead. |
| 26 | test.provider.skipIf(true)( |
| 27 | "dev runs the framework server with no cloud resources", |
| 28 | (stack) => |
| 29 | Effect.gen(function* () { |
| 30 | yield* stack.destroy(); |
| 31 | |
| 32 | const rootDir = yield* cloneFixture(fixtureDir, { |
| 33 | prefix: "alchemy-vocs-gcp-local-", |
| 34 | tempRoot, |
| 35 | entries: fixtureEntries, |
| 36 | }); |
| 37 | |
| 38 | const deployed = yield* stack.deploy( |
| 39 | Effect.gen(function* () { |
| 40 | const site = yield* GCP.Website.Vocs("Web", { |
| 41 | rootDir, |
| 42 | }); |
| 43 | return { site }; |
| 44 | }), |
| 45 | ); |
| 46 | |
| 47 | const url = deployed.site.url; |
| 48 | expect(url).toMatch(/^http:\/\/(localhost|127\.0\.0\.1):\d+\/?$/); |
| 49 | expect(deployed.site.service).toBeUndefined(); |
| 50 | |
| 51 | yield* expectUrlContains(`${url}/`, "Alchemy with Vocs", { |
| 52 | timeout: "90 seconds", |
| 53 | label: "dev home page", |
| 54 | }); |
| 55 | |
| 56 | yield* stack.destroy(); |
| 57 | }), |
| 58 | { |
| 59 | tags: ["provider:gcp", "provider:gcp:website", "live"], |
| 60 | timeout: 180_000, |
| 61 | }, |
| 62 | ); |
| 63 | }, |
| 64 | ); |