1 Commits

Author SHA1 Message Date
a6a1e7cd75 v0.3.0: add Playwright test (30/30), mark §F release gate done
Implements tests/PLAN.md § Playwright run (Section F's release
gate). 30 assertions in tests/verify-hooks-lib-foundry.mjs,
runs in ~10s against a live Foundry v14 instance.

What the Playwright test verifies that the no-Foundry smoke
test CAN'T:
- The library's init hook runs in Foundry's real lifecycle
  (not a stubbed manual init call).
- mod.api is set on game.modules.get('foundry-hooks-lib') with
  the documented surface.
- install() at init calls Hooks.on for every raw hook in the
  registered set.
- A real Foundry-fired hook (combatStart, combatRound) delivers
  an envelope to a consumer that subscribed AFTER init.
- A synthetic Hooks.callAll fire delivers envelopes to
  subscribers (sync-mode hooks via direct dispatch,
  async-mode hooks via microtask).
- subscribeAll receives envelopes from every registered hook.
- subscribe with an unknown hook name throws TypeError.
- A throwing consumer does NOT break the dispatch chain; the
  second subscriber still fires; the error is logged via
  console.error with the [foundry-hooks-lib] prefix.
- subscribe + unsubscribe correctly gate delivery.

**Bumps package.json to 0.3.0** (was 0.2.0 — version lagged
behind module.json's 0.3.0 from the rename commit).

**Adds test:foundry and test:all npm scripts.**

**Marks tests/PLAN.md status as Implemented** (was Proposed).
The Definition of done gate (npm run test:foundry exits 0 in
<30s) is now met.

**Adds playwright-core as a devDependency** (1 package, ~no
runtime impact since this repo's module doesn't depend on it at
runtime — it's a test-only dep).

**Final tallies:**
- npm test: 554/554 in ~0.4s (no-Foundry smoke)
- npm run test:foundry: 30/30 in ~10s (Playwright)
- npm run test:perf: 6/6 in ~5s (median 0.0003ms/fire)
- npm run test:all: all of the above
2026-06-20 17:27:44 -04:00