diff options
author | 2025-02-07 08:59:05 +0000 | |
---|---|---|
committer | 2025-02-07 08:59:05 +0000 | |
commit | 9b8042a1ed2068c398d77a73503b82d3e68424d1 (patch) | |
tree | 960627bc09d455e04fcf75b11d0452349b35e6d4 /packages/integrations/cloudflare/test/_test-utils.js | |
parent | a7776b8036155143ca99790233800667dc1b6abc (diff) | |
download | astro-9b8042a1ed2068c398d77a73503b82d3e68424d1.tar.gz astro-9b8042a1ed2068c398d77a73503b82d3e68424d1.tar.zst astro-9b8042a1ed2068c398d77a73503b82d3e68424d1.zip |
chore: move cloudflare adapter to core monorepo
Diffstat (limited to 'packages/integrations/cloudflare/test/_test-utils.js')
-rw-r--r-- | packages/integrations/cloudflare/test/_test-utils.js | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/packages/integrations/cloudflare/test/_test-utils.js b/packages/integrations/cloudflare/test/_test-utils.js index d2db799a1..381c66a8b 100644 --- a/packages/integrations/cloudflare/test/_test-utils.js +++ b/packages/integrations/cloudflare/test/_test-utils.js @@ -1,5 +1,7 @@ import { fileURLToPath } from 'node:url'; import { execa } from 'execa'; +import { loadFixture as baseLoadFixture } from '../../../astro/test/test-utils.js'; + /** * @typedef {{ stop: Promise<void>, port: number }} WranglerCLI */ @@ -18,7 +20,7 @@ export function astroCli(cwd, /** @type {string[]} */ ...args) { } const wranglerPath = fileURLToPath( - new URL('../node_modules/wrangler/bin/wrangler.js', import.meta.url) + new URL('../node_modules/wrangler/bin/wrangler.js', import.meta.url), ); /** Returns a process running the Wrangler CLI. */ @@ -41,7 +43,7 @@ export function wranglerCli(cwd) { { env: { CI: 1, CF_PAGES: 1 }, cwd: cwd, - } + }, ); spawned.stdout.setEncoding('utf8'); @@ -49,3 +51,17 @@ export function wranglerCli(cwd) { return spawned; } + +/** + * @typedef {import('../../../astro/test/test-utils').Fixture} Fixture + */ +export function loadFixture(inlineConfig) { + if (!inlineConfig?.root) throw new Error("Must provide { root: './fixtures/...' }"); + + // resolve the relative root (i.e. "./fixtures/tailwindcss") to a full filepath + // without this, the main `loadFixture` helper will resolve relative to `packages/astro/test` + return baseLoadFixture({ + ...inlineConfig, + root: new URL(inlineConfig.root, import.meta.url).toString(), + }); +} |