Lets the CI preview server stand in for the contact API
With contactForm.enabled=true the e2e and Lighthouse runs asked a token route that CI does not have (404, console error, run 666). The preview server gets an opt-in --contact-stub (token 200 without captcha, submit 202); the e2e server helper and the Lighthouse start command switch it on. Tests that need another answer still replace it per page with page.route. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,8 +10,13 @@ export const clientDir = resolve('dist/client');
|
||||
// Dezelfde server als `pnpm preview`, met de productie-CSP en echte 404's,
|
||||
// op een poort die het systeem kiest zodat tests elkaar niet in de weg zitten.
|
||||
// auditRoute zet de opt-in route /__audit/404 aan, zoals Lighthouse hem start.
|
||||
// De contact-API wordt standaard nagebootst (CI heeft geen CMS-host); een
|
||||
// test die iets anders nodig heeft vervangt het met page.route.
|
||||
export async function startServer(options: { auditRoute?: boolean } = {}) {
|
||||
const server = await startPreviewServer(clientDir, 0, options);
|
||||
const server = await startPreviewServer(clientDir, 0, {
|
||||
contactStub: true,
|
||||
...options,
|
||||
});
|
||||
const { port } = server.address() as AddressInfo;
|
||||
return {
|
||||
origin: `http://127.0.0.1:${port}`,
|
||||
|
||||
Reference in New Issue
Block a user