mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-14 08:53:11 +00:00
Fase 1: playwright bare (--list, extensão VS Code, runs ad-hoc) quebrava na coleta — next@15 sem exports não resolve 'next/cache' em ESM nativo e server-only exige a condição react-server; o script test:e2e carregava ambas via NODE_OPTIONS (por isso o CI passava). Hook de resolução ESM vitest-free (e2eEsmResolve.mjs) registrada no main via module.register + propagada aos workers via NODE_OPTIONS quando invocada bare; path do script intocado. Fase 2: a sequência persistente campaign_fixture_municipality_alloc nunca é resetada e um ciclo completo claima ~505 do catálogo de 435 — o wrap em todo ciclo em DB de worktree fazia dois runs concorrentes receberem o mesmo índice e purgarem as linhas vivas um do outro. Registry de claims compartilhado vitest-free (campaignMunicipalityAllocator.ts): INSERT ON CONFLICT DO NOTHING com skip de slot vivo, steal de claim stale (TTL 2h), release no cleanup dos dois fixtures, erro claro de exaustão. Guard estático no testMunicipalityAllocatorConventions + spec int de stress.
29 lines
1.3 KiB
JavaScript
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)
|
|
}
|