chore/plugin-implementer-cli-usage
1
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
019b427442 |
test: round 3 — consolidated test bedrock + stryker setup
Consolidates four overlapping test-infra PRs (#113, #114, #117, #118) into a single coherent batch. Each contributing PR has redundancies with one or more of the others; together they ship a real ~134-test expansion of the unit suite plus mutation-testing infrastructure. Same shape as #110 / #111: small, focused, behavior-pinning tests against load-bearing systems. Each test answers one question — *what specific regression does it catch that I'd otherwise find from a user bug report?* Tests pin observable contracts (events emitted, cache entries written, public-API state) rather than internal mechanics, so they survive refactors during the longer-term migration toward the six-interface architecture. ## What's in this PR ### Stryker mutation testing (new in this batch) - `stryker.config.json` — hybrid config: `coverageAnalysis: "perTest"` for the 5–10× speedup on a real codebase, `ignoreStatic: true` to drop false-positive mutants in module-load code, and a `mutate` scope of `src/core/**` + `src/lib/**` covering the logic-heavy layers without dragging the React component surface into noise. - `.github/workflows/mutation-testing.yml` — runs Stryker on a weekly schedule (Sundays 22:00 US Eastern / 03:00 UTC Monday) plus `workflow_dispatch` for on-demand validation. Per-PR triggering would be too expensive (10–30 min per run even with `perTest`). - `package.json` — adds `@stryker-mutator/core`, `@stryker-mutator/vitest-runner`, and `fast-check` as devDependencies. New `test:mutate` script. ### New test files (22 added) Plugin lifecycle and loaders: - `src/core/plugins/PluginManager.test.ts` — orchestrator lifecycle: register, enable, disable, data-flow contract, getAllEntities filters by enabled, updateTimeRange, destroy, togglePlugin, loadFromManifest. 11 tests. - `src/core/plugins/loadPluginFromManifest.test.ts` - `src/core/plugins/validateManifest.test.ts` - `src/core/plugins/loaders/mapGeoJsonToEntities.test.ts` - `src/core/plugins/loaders/mapJsonToEntities.test.ts` Data layer: - `src/core/data/DataUtils.test.ts` - `src/core/data/WsClient.test.ts` State (9 Zustand slices + the integration tests): - `src/core/state/StateSlices.test.ts` - `src/core/state/configSlice.test.ts` - `src/core/state/dataSlice.test.ts` - `src/core/state/favoritesSlice.test.ts` - `src/core/state/filterSlice.test.ts` - `src/core/state/geojsonSlice.test.ts` - `src/core/state/globeSlice.test.ts` - `src/core/state/layersSlice.test.ts` - `src/core/state/timelineSlice.test.ts` - `src/core/state/uiSlice.test.ts` Filters: - `src/core/filters/filterEngine.test.ts` Library: - `src/lib/AuthConfig.test.ts` - `src/lib/analytics.test.ts` - `src/lib/origin.test.ts` ### Test files extended (9 modified) Property-based and edge-case additions to existing tests, drawn from the upstream PRs: - `src/core/plugins/loaders/getNestedValue.test.ts` (+46 lines) - `src/lib/geojson/converter.test.ts` (+31) - `src/lib/geojson/normalizer.test.ts` (+52) - `src/lib/rateLimit.test.ts` (+44) - `src/core/plugins/loaders/DeclarativePlugin.test.ts` (+147 — type fixes for `DataSourceConfig.method`/`pollInterval`/`format`) - `src/lib/marketplace/cors.test.ts` (+5) - `src/lib/marketplace/marketplaceToken.test.ts` (+21) - `src/core/filters/filterEngine.test.ts` (type-corrected — uses `latitude`/`longitude` not `position.lat`/`lon`, nested `range: { min, max, step }` config, etc.) ## What's *not* in this PR (intentionally) - **Duplicate tests for code already on main.** #113 originally included `.spec.ts` versions of `CacheLayer`, `DataBus`, `PollingManager`, `cors`, `marketplaceToken`, `repository`, `rateLimit`, `edition`, and `seedDefaultPlugins` — all of which are already tested via `.test.ts` files on main from #110 + prior. Vitest picks up both `.test.ts` and `.spec.ts`, so keeping both would double the maintenance burden without adding signal. Dropped. - **Tautological tests.** A few accessors-only tests from #113 (`getEntities` returning the cached array, `getAllPlugins().length` equals N) were dropped per the test-writing bar set on #110/#111: each test must catch a specific bug class that two different broken implementations would fail differently on. - **`version` bump in `package.json`.** Three of the contributing PRs bumped the version line independently (2.9.5, 2.9.10, 2.9.10), each conflicting with the others. Reserve version bumps for explicit release commits — feature/test PRs should leave the version field alone to avoid this conflict hairball. - **A duplicate `stryker.conf.json`.** #114 used that filename; #117 used `stryker.config.json`. Stryker accepts both but only loads one (alphabetical resolution). Picked `stryker.config.json` as the canonical name. ## Verification ``` Test Files 38 passed (38) Tests 271 passed (271) ``` 137 tests on main before this PR; +134 from this consolidation, no regressions. Type check clean (`pnpm exec tsc --noEmit`). ## Replaces - PR #113 (test/improve-coverage) — most of its 18 truly-new files are included here; the 9 duplicate-of-main entries are not. - PR #114 (chore/stryker-setup) — its CI workflow shape is here with the trigger changed to weekly+manual instead of per-PR. - PR #117 (chore/stryker-and-fast-check) — its full deps and test additions are here. - PR #118 (test/improve-project-coverage) — the type-corrected versions of its 6 test files are here, including the typefix commit pushed to that branch earlier. Each of those PRs should be closed once this lands, with a comment referencing this PR for credit. Co-Authored-By: silvertakana <[email protected]> |