This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Development (starts local server + opens Cypress interactive runner)
npm run develop
# Build TypeScript to dist/
npm run build
# Type-check without emitting
npm run tsc:check
# Run tests headless
npm test
# Run tests in CI mode (no video)
npm run test-ci
# Start server + run CI tests
npm run full-test
# Lint and format checks
npx eslint .
npm run prettier:check
# Multi-version compatibility test (used in CI)
npm run ciTests require a running local server on port 3999. npm run develop / npm run full-test handle this automatically via start-server-and-test.
To run a single spec file, open Cypress interactively with npm run test-open and select the spec, or pass --spec to cypress run:
npx cypress run --spec "cypress/e2e/components/button.spec.ts"This library exposes singleton helper instances that wrap Cypress commands to handle Ionic's Shadow DOM complexity. Consumers add includeShadowDom: true to their cypress.config and use the helpers instead of raw cy.get().
- Ionic ≤ 7 →
cypress-ionic0.x.x - Ionic ≥ 8 →
cypress-ionic1.x.x
index.ts— re-exports all public singletons and typescomponents/— one class per Ionic component, each exported as a singleton:IonButtonCypress→ionButtonCypressIonInputCypress→ionInputCypressIonRangeCypress→ionRangeCypressIonSelectCypress→ionSelectCypress(orchestrates three sub-strategies: alert, action-sheet, popover)
interfaces/— shared TypeScript types;SupportedSelectors<T>is the union ofstring | JQuery<T> | Cypress.Chainable<JQuery<T>>accepted by every public methodhelpers/get-from-supported-selector.ts— normalizes anySupportedSelectorsinput to aCypress.Chainableand asserts the.hydratedclass (confirms Ionic has initialized the element)
Every public method on a component class must return Cypress.Chainable<JQuery<ComponentElement>> — enforced by the CypressIonicComponentClass<T, C> interface.
/html/index.html+/html/assets/scripts.mjs— static page with real Ionic components served on port 3999 during testscypress/e2e/components/— one spec per componenttest-helpers/— shared Cypress test utilities
@lib → ./src/index.ts
@interfaces → ./src/interfaces/index.ts
@helpers → ./src/helpers/index.ts
Aliases are resolved at build time by typescript-transform-paths (ts-patch plugin).
- Prefer backward-compatible changes. When a fix can support both the current and a newer version of a dependency (e.g. via comma-separated CSS selectors, feature detection, or a simple fallback), do so rather than raising the
peerDependencyfloor. Only drop support for a version when backward compatibility is genuinely impossible.
- Prefer backward-compatible changes. When a fix can support both the current and a newer version of a dependency (e.g. via comma-separated CSS selectors, feature detection, or a simple fallback), do so rather than raising the
peerDependencyfloor. Only drop support for a version when backward compatibility is genuinely impossible.
Commits must follow Conventional Commits (enforced by commitlint + Husky). Allowed types: build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test, release, wip.
Staged files are auto-formatted by pretty-quick on pre-commit.