summaryrefslogtreecommitdiff
path: root/packages/integrations/prefetch/test/test-utils.js
blob: 198ecaafa967d57f39c7f70acba6577ad5cf910e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { test as testBase } from '@playwright/test';
import { loadFixture as baseLoadFixture } from '../../../astro/test/test-utils.js';

export function loadFixture(inlineConfig) {
	if (!inlineConfig || !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(),
	});
}

export function testFactory(inlineConfig) {
	let fixture;

	const test = testBase.extend({
		astro: async ({}, use) => {
			fixture = await loadFixture(inlineConfig);
			await use(fixture);
		},
	});

	test.afterEach(() => {
		fixture.resetAllFiles();
	});

	return test;
}
eletions'>-1038/+1096 2022-05-12[ci] formatGravatar matthewp 2-2/+2 2022-05-12add error hints (#3350)Gravatar Fred K. Schott 3-0/+19 2022-05-12[ci] formatGravatar matthewp 2-10/+6 2022-05-12Fix: React - Use "createRoot" instead of "hydrateRoot" for `client:only` (#3337)Gravatar Ben Holmes 4-22/+34 2022-05-12[ci] formatGravatar matthewp 1-2/+8 2022-05-12Resolve components by module ID during compilation (#3300)Gravatar Tony Sullivan 22-41/+407 2022-05-12[ci] collect statsGravatar FredKSchott 1-0/+1 2022-05-11Exclude `node-fetch` from vite.optimizeDeps (#3348)Gravatar Nate Moore 2-0/+6 2022-05-11fix: updated blog template with existing address (#3312)Gravatar Gautier Ben Aïm 1-2/+2 2022-05-11refactor(vercel): Build Output API v3 (#3216)Gravatar Juan Martín Seery 42-231/+659 2022-05-11Fix APIRoute type (#3344)Gravatar Matthew Phillips 3-11/+8 2022-05-11[create-astro] Finalize developer experience... with gradients 🚀 (#3313)Gravatar Ben Holmes 5-23/+123