teqo-backup/tests/helpers/e2eEsmResolve.mjs
Francisco Solla 9467e0f292 fix(campaign): C140 — manual dispatch in 18 forms prevents React 19 form reset on error
Fix manual dispatch em 18 formulários de /campanha que usavam <form action={submitAction}>: campos não controlados voltavam ao defaultValue após qualquer action assentada (sucesso ou erro) do React 19.

- WizardStepFormChrome alterado uma vez (cobre 3 wizard steps)
- 15 forms recebem dispatch manual arquivo a arquivo
- AdvisorPasswordResetButton (2 micro-forms sem campo digitável) ficou como está
- Unit spec novo campaignWizardStepFormChrome.unit.spec.tsx
- CHANGELOG-AGENTS.md cleaned (98 duplicates removed)

Also fixes:
- campaignPageActor writable gate only blocks advisors (was blocking coordinators too)
- campaignLeaderships e2e stability (waitForLoadState before attribute assertion)
2026-08-23 17:54:19 -03:00

29 lines
1.3 KiB
JavaScript

/**
* OPS46 — ESM resolution hook for the Playwright runner process.
*
* next@15 ships NO `exports` map in its package.json, so native Node ESM
* cannot resolve the bare `next/cache` subpath (the file exists as
* `cache.js`, but ESM never tries extensions); `server-only` needs the
* `react-server` export condition. `pnpm test:e2e` papers over both with
* NODE_OPTIONS flags (`--conditions=react-server --import=tsx/esm`), but a
* bare `playwright test` (VS Code extension, `--list`, ad-hoc runs) has
* neither. This hook applies the same two resolutions in-process:
* - `next/cache` → `next/cache.js` (the shipped, TS-mapped entry)
* - inject `react-server` into the resolution conditions (same effect as
* the `--conditions=react-server` flag)
*
* Registered in the main process by `playwright.config.ts` and passed to the
* worker processes via `NODE_OPTIONS=--import=...` (see `e2eEsmLoader.mjs`).
*/
export async function resolve(specifier, context, nextResolve) {
if (specifier === 'next/cache') {
return nextResolve('next/cache.js', context)
}
if (!context.conditions.includes('react-server')) {
return nextResolve(specifier, {
...context,
conditions: ['react-server', ...context.conditions],
})
}
return nextResolve(specifier, context)
}