diff --git a/CLAUDE.md b/CLAUDE.md index 569e3fa..d0a39fe 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,14 +6,25 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ```bash npm run build # tsc emits individual ESM modules to dist/ (no bundling) -npm run typecheck # tsc --noEmit -npm run lint # oxlint over src/ +npm run typecheck # tsc --noEmit, then tsc -p tsconfig.test.json for test/ +npm run lint # oxlint over src/ and test/ npm run format # Prettier formatting +npm run test # vitest run +npm run test:watch # vitest, watch mode ``` Linting runs on `oxlint`, not ESLint/`@typescript-eslint`. This project pins `typescript@^7.0.2`, and `@typescript-eslint` has no released version that supports it (peer range caps at `<6.1.0`, and even loading `@typescript-eslint/parser` crashes against TS 7's package shape). `oxlint` has its own parser and doesn't touch the `typescript` package, so it works regardless of TS version — the tradeoff is no type-aware rules (no `no-floating-promises`, `no-unnecessary-condition`, etc.). Revisit once `@typescript-eslint` supports TS 7. -There are no tests in this project. To preview components locally, open `index.html` in a browser with any static-file server. +### Testing + +Tests run under Vitest + jsdom (`test/**/*.test.ts`), with a single setup file (`test/setup.ts`) that stubs `ResizeObserver` -- jsdom doesn't implement it, and `leaflet-map.ts` constructs one unconditionally. Real Leaflet objects work fine under jsdom for everything this library actually needs to verify (option/attribute wiring, event forwarding); no browser is required. Two things worth knowing: + +- Some Leaflet DOM state (the ``/`