diff options
author | 2024-05-03 17:40:53 +0200 | |
---|---|---|
committer | 2024-05-03 17:40:53 +0200 | |
commit | a37d76a42ac00697be3acd575f3f7163129ea75c (patch) | |
tree | 99c2c542e07eb49643cb682cecc31250dfd8bd9e /packages/integrations/web-vitals/test/test-utils.js | |
parent | befbda7fa3d712388789a5a9be1e0597834f86db (diff) | |
download | astro-a37d76a42ac00697be3acd575f3f7163129ea75c.tar.gz astro-a37d76a42ac00697be3acd575f3f7163129ea75c.tar.zst astro-a37d76a42ac00697be3acd575f3f7163129ea75c.zip |
Add web-vitals integration (#10883)
Diffstat (limited to 'packages/integrations/web-vitals/test/test-utils.js')
-rw-r--r-- | packages/integrations/web-vitals/test/test-utils.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/packages/integrations/web-vitals/test/test-utils.js b/packages/integrations/web-vitals/test/test-utils.js new file mode 100644 index 000000000..8dd4d970b --- /dev/null +++ b/packages/integrations/web-vitals/test/test-utils.js @@ -0,0 +1,16 @@ +import { loadFixture as baseLoadFixture } from '../../../astro/test/test-utils.js'; + +/** @typedef {import('../../../astro/test/test-utils').Fixture} Fixture */ +/** @typedef {import('../../../astro/test/test-utils').DevServer} DevServer */ + +/** @type {typeof import('../../../astro/test/test-utils.js')['loadFixture']} */ +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(), + }); +} |