{"version":3,"file":"testing.cjs","names":[],"sources":["../src/testing/index.ts"],"sourcesContent":["/**\n * Testing utilities for Ore components\n *\n * ⚠️ Requires DOM environment (browser / jsdom / happy-dom)\n *\n * This barrel re-exports the full testing API for convenience.\n * For tree-shaking, import directly from the focused sub-modules.\n */\n\nimport { installFormInternalsPolyfill } from './form-internals-polyfill';\nimport { cleanup } from './mount';\n\n// Testing-only error: flush() is its only thrower in this package (a pending-work timeout —\n// see flush.ts). Exported here (not from the main `.` entry) so components with no interest\n// in the testing sub-path don't carry a testing-only error class in their public type surface.\n// Generic DOM interaction helpers belong to @vielzeug/assay, not this Ore-specific test API.\nexport { OreTimeoutError } from '../errors';\nexport { walkFlatTree } from './dom';\nexport { debugFlush, type FlushOptions, flush } from './flush';\nexport { installFormInternalsPolyfill } from './form-internals-polyfill';\nexport { cleanup, type Fixture, type MountOptions, type MountSetup, mock, mount, mountComponent } from './mount';\nexport { type HookFixture, renderHook } from './render-hook';\nexport { resetOreForTests } from './reset';\n\nexport type InstallOptions = {\n  /**\n   * Polyfill the jsdom/happy-dom gaps in `ElementInternals`/`FormData`/`<form>.reset()`\n   * that `useField()` needs (see `installFormInternalsPolyfill`). Global monkey-patches,\n   * so opt in only when the suite tests form-associated components.\n   * @default false\n   */\n  formInternals?: boolean;\n};\n\n/**\n * Register auto-cleanup after each test. Call once in your test setup file.\n * Pass `{ formInternals: true }` when testing form-associated (`useField`) components.\n *\n * @example\n * // vitest.setup.ts\n * import { afterEach } from 'vitest';\n * import { install } from '@vielzeug/ore/testing';\n * install(afterEach, { formInternals: true });\n */\nexport function install(afterEachHook: (fn: () => void) => void, options: InstallOptions = {}): void {\n  afterEachHook(cleanup);\n\n  if (options.formInternals) installFormInternalsPolyfill();\n}\n"],"mappings":"+TA4CA,SAAgB,EAAQ,EAAyC,EAA0B,CAAC,EAAS,CACnG,EAAc,EAAA,OAAO,EAEjB,EAAQ,eAAe,EAAA,6BAA6B,CAC1D"}