@ctrl/dom 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NOTICE +338 -0
- package/README.md +362 -2
- package/dist/aria/_chunks/roles-list-CYZF-l9K.js +1503 -0
- package/dist/aria/_chunks/roles-list-D4WCyRO_.cjs +1754 -0
- package/dist/aria/index.cjs +232 -0
- package/dist/aria/index.js +198 -0
- package/dist/aria/internal.cjs +69 -0
- package/dist/aria/internal.js +30 -0
- package/dist/aria/types/accname.d.ts +40 -0
- package/dist/aria/types/data/aria-query.d.ts +61 -0
- package/dist/aria/types/data/aria-query.generated.d.ts +2 -0
- package/dist/aria/types/forms.d.ts +25 -0
- package/dist/aria/types/hidden.d.ts +38 -0
- package/dist/aria/types/index.d.ts +46 -0
- package/dist/aria/types/internal.d.ts +15 -0
- package/dist/aria/types/role.d.ts +27 -0
- package/dist/aria/types/roles-list.d.ts +18 -0
- package/dist/aria/types/states.d.ts +29 -0
- package/dist/aria/types/style.d.ts +18 -0
- package/dist/aria/types/tree.d.ts +20 -0
- package/dist/bridge/index.cjs +3 -0
- package/dist/bridge/index.js +4 -0
- package/dist/bridge/internal.cjs +3 -0
- package/dist/bridge/internal.js +4 -0
- package/dist/cli/_chunks/report-DdncYfuJ.js +93 -0
- package/dist/cli/ctrl-dom.js +199 -0
- package/dist/cli/jest-reporter.js +55 -0
- package/dist/cli/vitest-reporter.js +81 -0
- package/dist/dom/_chunks/src-Hv_BAHIV.js +47537 -0
- package/dist/dom/index.js +3 -0
- package/dist/dom/internal.js +434 -0
- package/dist/dom/types/collections/DOMStringMap.d.ts +8 -0
- package/dist/dom/types/collections/DOMTokenList.d.ts +33 -0
- package/dist/dom/types/collections/HTMLCollection.d.ts +62 -0
- package/dist/dom/types/collections/NamedNodeMap.d.ts +22 -0
- package/dist/dom/types/collections/NodeList.d.ts +43 -0
- package/dist/dom/types/collections/indexed.d.ts +8 -0
- package/dist/dom/types/collections/iterator.d.ts +8 -0
- package/dist/dom/types/css/CSS.d.ts +21 -0
- package/dist/dom/types/css/CSSStyleDeclaration.d.ts +57 -0
- package/dist/dom/types/css/cascade.d.ts +159 -0
- package/dist/dom/types/css/colors.d.ts +28 -0
- package/dist/dom/types/css/computed.d.ts +22 -0
- package/dist/dom/types/css/cssom.d.ts +363 -0
- package/dist/dom/types/css/data/properties.d.ts +1 -0
- package/dist/dom/types/css/declarations.d.ts +40 -0
- package/dist/dom/types/css/index.d.ts +5 -0
- package/dist/dom/types/css/inline-count.d.ts +2 -0
- package/dist/dom/types/css/internal.d.ts +11 -0
- package/dist/dom/types/css/layout-mode.d.ts +4 -0
- package/dist/dom/types/css/layout.d.ts +63 -0
- package/dist/dom/types/css/media.d.ts +55 -0
- package/dist/dom/types/css/parser.d.ts +93 -0
- package/dist/dom/types/css/properties.d.ts +28 -0
- package/dist/dom/types/css/resize-observer.d.ts +19 -0
- package/dist/dom/types/css/selector-info.d.ts +13 -0
- package/dist/dom/types/css/shorthands.d.ts +33 -0
- package/dist/dom/types/css/stylesheets.d.ts +93 -0
- package/dist/dom/types/css/supports.d.ts +4 -0
- package/dist/dom/types/css/tokenizer.d.ts +91 -0
- package/dist/dom/types/css/values.d.ts +91 -0
- package/dist/dom/types/css/view.d.ts +44 -0
- package/dist/dom/types/events/DataTransfer.d.ts +62 -0
- package/dist/dom/types/events/Event.d.ts +115 -0
- package/dist/dom/types/events/EventTarget.d.ts +22 -0
- package/dist/dom/types/events/UIEvents.d.ts +308 -0
- package/dist/dom/types/events/activation.d.ts +7 -0
- package/dist/dom/types/events/convert.d.ts +16 -0
- package/dist/dom/types/events/createEvent.d.ts +3 -0
- package/dist/dom/types/events/dispatch.d.ts +39 -0
- package/dist/dom/types/events/events.d.ts +200 -0
- package/dist/dom/types/events/fire.d.ts +21 -0
- package/dist/dom/types/events/handlers.d.ts +14 -0
- package/dist/dom/types/events/listeners.d.ts +32 -0
- package/dist/dom/types/events/report.d.ts +10 -0
- package/dist/dom/types/html/HTMLElement.d.ts +126 -0
- package/dist/dom/types/html/MathMLElement.d.ts +6 -0
- package/dist/dom/types/html/SVGElement.d.ts +145 -0
- package/dist/dom/types/html/anchor.d.ts +16 -0
- package/dist/dom/types/html/aria-reflection.d.ts +14 -0
- package/dist/dom/types/html/collection.d.ts +5 -0
- package/dist/dom/types/html/custom-elements.d.ts +129 -0
- package/dist/dom/types/html/elements.d.ts +202 -0
- package/dist/dom/types/html/events.d.ts +22 -0
- package/dist/dom/types/html/focus.d.ts +63 -0
- package/dist/dom/types/html/forms/FileList.d.ts +1 -0
- package/dist/dom/types/html/forms/FormData.d.ts +7 -0
- package/dist/dom/types/html/forms/HTMLButtonElement.d.ts +36 -0
- package/dist/dom/types/html/forms/HTMLFieldSetElement.d.ts +29 -0
- package/dist/dom/types/html/forms/HTMLFormElement.d.ts +61 -0
- package/dist/dom/types/html/forms/HTMLInputElement.d.ts +204 -0
- package/dist/dom/types/html/forms/HTMLLabelElement.d.ts +15 -0
- package/dist/dom/types/html/forms/HTMLOptionElement.d.ts +61 -0
- package/dist/dom/types/html/forms/HTMLOutputElement.d.ts +74 -0
- package/dist/dom/types/html/forms/HTMLSelectElement.d.ts +96 -0
- package/dist/dom/types/html/forms/HTMLTextAreaElement.d.ts +82 -0
- package/dist/dom/types/html/forms/autofill.d.ts +10 -0
- package/dist/dom/types/html/forms/collections.d.ts +112 -0
- package/dist/dom/types/html/forms/common.d.ts +36 -0
- package/dist/dom/types/html/forms/face.d.ts +59 -0
- package/dist/dom/types/html/forms/form-associated.d.ts +46 -0
- package/dist/dom/types/html/forms/form-submission.d.ts +55 -0
- package/dist/dom/types/html/forms/index.d.ts +17 -0
- package/dist/dom/types/html/forms/input-type.d.ts +50 -0
- package/dist/dom/types/html/forms/microsyntaxes.d.ts +52 -0
- package/dist/dom/types/html/forms/state.d.ts +54 -0
- package/dist/dom/types/html/forms/ui.d.ts +35 -0
- package/dist/dom/types/html/forms/user-validity.d.ts +19 -0
- package/dist/dom/types/html/forms/validation.d.ts +76 -0
- package/dist/dom/types/html/index.d.ts +13 -0
- package/dist/dom/types/html/innerText.d.ts +9 -0
- package/dist/dom/types/html/interactive.d.ts +43 -0
- package/dist/dom/types/html/invokers.d.ts +39 -0
- package/dist/dom/types/html/media.d.ts +86 -0
- package/dist/dom/types/html/reflect.d.ts +67 -0
- package/dist/dom/types/html/registry.d.ts +9 -0
- package/dist/dom/types/html/resources.d.ts +55 -0
- package/dist/dom/types/html/shared.d.ts +22 -0
- package/dist/dom/types/html/slot.d.ts +15 -0
- package/dist/dom/types/html/template.d.ts +18 -0
- package/dist/dom/types/html/top-layer.d.ts +73 -0
- package/dist/dom/types/index.d.ts +50 -0
- package/dist/dom/types/internal.d.ts +61 -0
- package/dist/dom/types/keys.d.ts +209 -0
- package/dist/dom/types/nodes/Attr.d.ts +25 -0
- package/dist/dom/types/nodes/CharacterData.d.ts +35 -0
- package/dist/dom/types/nodes/Document.d.ts +169 -0
- package/dist/dom/types/nodes/DocumentFragment.d.ts +12 -0
- package/dist/dom/types/nodes/DocumentType.d.ts +17 -0
- package/dist/dom/types/nodes/Element.d.ts +142 -0
- package/dist/dom/types/nodes/Node.d.ts +112 -0
- package/dist/dom/types/nodes/NodeImpl.d.ts +90 -0
- package/dist/dom/types/nodes/ShadowRoot.d.ts +43 -0
- package/dist/dom/types/nodes/attr-nodes.d.ts +8 -0
- package/dist/dom/types/nodes/attributes.d.ts +46 -0
- package/dist/dom/types/nodes/cache.d.ts +38 -0
- package/dist/dom/types/nodes/character-data.d.ts +5 -0
- package/dist/dom/types/nodes/clone.d.ts +5 -0
- package/dist/dom/types/nodes/constants.d.ts +52 -0
- package/dist/dom/types/nodes/create.d.ts +42 -0
- package/dist/dom/types/nodes/derived.d.ts +26 -0
- package/dist/dom/types/nodes/inspect.d.ts +2 -0
- package/dist/dom/types/nodes/mixins.d.ts +41 -0
- package/dist/dom/types/nodes/names.d.ts +15 -0
- package/dist/dom/types/nodes/slots.d.ts +38 -0
- package/dist/dom/types/nodes/tags.d.ts +8 -0
- package/dist/dom/types/nodes/traverse.d.ts +21 -0
- package/dist/dom/types/nodes/tree.d.ts +47 -0
- package/dist/dom/types/observers/MutationObserver.d.ts +33 -0
- package/dist/dom/types/observers/MutationRecord.d.ts +17 -0
- package/dist/dom/types/observers/queue.d.ts +45 -0
- package/dist/dom/types/parser/entities-data.d.ts +3 -0
- package/dist/dom/types/parser/entities.d.ts +11 -0
- package/dist/dom/types/parser/index.d.ts +34 -0
- package/dist/dom/types/parser/tags.d.ts +182 -0
- package/dist/dom/types/parser/tokenizer.d.ts +109 -0
- package/dist/dom/types/parser/treebuilder.d.ts +271 -0
- package/dist/dom/types/parser/xml.d.ts +14 -0
- package/dist/dom/types/selectors/compile.d.ts +154 -0
- package/dist/dom/types/selectors/filter.d.ts +21 -0
- package/dist/dom/types/selectors/html-predicates.d.ts +1 -0
- package/dist/dom/types/selectors/index.d.ts +16 -0
- package/dist/dom/types/selectors/internal.d.ts +87 -0
- package/dist/dom/types/selectors/parser.d.ts +310 -0
- package/dist/dom/types/selectors/serialize.d.ts +20 -0
- package/dist/dom/types/selectors/state.d.ts +43 -0
- package/dist/dom/types/serializer/index.d.ts +29 -0
- package/dist/dom/types/trace.d.ts +51 -0
- package/dist/dom/types/traversal/Range.d.ts +113 -0
- package/dist/dom/types/traversal/Selection.d.ts +45 -0
- package/dist/dom/types/traversal/TreeWalker.d.ts +77 -0
- package/dist/dom/types/traversal/live.d.ts +46 -0
- package/dist/dom/types/webidl-runtime.d.ts +18 -0
- package/dist/dom/types/webidl.d.ts +34 -0
- package/dist/dom/types/window/DOMStringList.d.ts +14 -0
- package/dist/dom/types/window/FileList.d.ts +11 -0
- package/dist/dom/types/window/FileReader.d.ts +27 -0
- package/dist/dom/types/window/History.d.ts +43 -0
- package/dist/dom/types/window/Location.d.ts +46 -0
- package/dist/dom/types/window/Navigator.d.ts +79 -0
- package/dist/dom/types/window/Screen.d.ts +27 -0
- package/dist/dom/types/window/Storage.d.ts +28 -0
- package/dist/dom/types/window/Window.d.ts +329 -0
- package/dist/dom/types/window/abort.d.ts +4 -0
- package/dist/dom/types/window/browsing-context.d.ts +12 -0
- package/dist/dom/types/window/clock.d.ts +163 -0
- package/dist/dom/types/window/compat.d.ts +34 -0
- package/dist/dom/types/window/cookies.d.ts +21 -0
- package/dist/dom/types/window/current.d.ts +7 -0
- package/dist/dom/types/window/document.d.ts +19 -0
- package/dist/dom/types/window/events.d.ts +11 -0
- package/dist/dom/types/window/fallbacks.d.ts +20 -0
- package/dist/dom/types/window/geometry.d.ts +133 -0
- package/dist/dom/types/window/globals.d.ts +7 -0
- package/dist/dom/types/window/hooks.d.ts +22 -0
- package/dist/dom/types/window/host-originals.d.ts +9 -0
- package/dist/dom/types/window/interfaces.d.ts +13 -0
- package/dist/dom/types/window/isolation.d.ts +20 -0
- package/dist/dom/types/window/media.d.ts +33 -0
- package/dist/dom/types/window/not-implemented.d.ts +23 -0
- package/dist/dom/types/window/observers.d.ts +42 -0
- package/dist/dom/types/window/origin.d.ts +3 -0
- package/dist/dom/types/window/timers.d.ts +28 -0
- package/dist/dom/types/window/xhr.d.ts +108 -0
- package/dist/jest-dom/_chunks/matchers-CDnnXUfG.js +2211 -0
- package/dist/jest-dom/_chunks/matchers-D988Ducb.cjs +2516 -0
- package/dist/jest-dom/index.cjs +5 -0
- package/dist/jest-dom/index.js +6 -0
- package/dist/jest-dom/jest-globals.cjs +6 -0
- package/dist/jest-dom/jest-globals.js +7 -0
- package/dist/jest-dom/matchers.cjs +53 -0
- package/dist/jest-dom/matchers.js +3 -0
- package/dist/jest-dom/types/bun.d.ts +13 -0
- package/dist/jest-dom/types/index.d.ts +3 -0
- package/dist/jest-dom/types/jest-globals.d.ts +13 -0
- package/dist/jest-dom/types/jest.d.ts +15 -0
- package/dist/jest-dom/types/matchers-standalone.d.ts +32 -0
- package/dist/jest-dom/types/matchers.d.ts +1079 -0
- package/dist/jest-dom/types/package.json +1 -0
- package/dist/jest-dom/types/vitest.d.ts +16 -0
- package/dist/jest-dom/vitest.cjs +6 -0
- package/dist/jest-dom/vitest.js +7 -0
- package/dist/react/_chunks/pure-DZ97z2oT.cjs +498 -0
- package/dist/react/_chunks/pure-PtE2hivW.js +420 -0
- package/dist/react/dont-cleanup-after-each.cjs +3 -0
- package/dist/react/dont-cleanup-after-each.js +4 -0
- package/dist/react/index.cjs +47 -0
- package/dist/react/index.js +35 -0
- package/dist/react/pure.cjs +17 -0
- package/dist/react/pure.js +5 -0
- package/dist/react/types/act-compat.d.ts +6 -0
- package/dist/react/types/config.d.ts +9 -0
- package/dist/react/types/dont-cleanup-after-each.d.ts +1 -0
- package/dist/react/types/dtl.d.ts +1 -0
- package/dist/react/types/fire-event.d.ts +3 -0
- package/dist/react/types/index.d.ts +1 -0
- package/dist/react/types/pure.d.ts +136 -0
- package/dist/register/index.js +11 -0
- package/dist/register/pure.js +147 -0
- package/dist/register/types/index.d.ts +1 -0
- package/dist/register/types/pure.d.ts +36 -0
- package/dist/testing-library/_chunks/aria-snapshot-diff-D7PzpXew.cjs +1170 -0
- package/dist/testing-library/_chunks/aria-snapshot-diff-Q8Wj33K0.js +985 -0
- package/dist/testing-library/agent.cjs +721 -0
- package/dist/testing-library/agent.js +713 -0
- package/dist/testing-library/index.cjs +2469 -0
- package/dist/testing-library/index.js +2390 -0
- package/dist/testing-library/types/agent.d.ts +56 -0
- package/dist/testing-library/types/aria-role.d.ts +99 -0
- package/dist/testing-library/types/aria-snapshot.d.ts +43 -0
- package/dist/testing-library/types/config.d.ts +27 -0
- package/dist/testing-library/types/events.d.ts +118 -0
- package/dist/testing-library/types/get-node-text.d.ts +1 -0
- package/dist/testing-library/types/get-queries-for-element.d.ts +182 -0
- package/dist/testing-library/types/index.d.ts +24 -0
- package/dist/testing-library/types/matches.d.ts +46 -0
- package/dist/testing-library/types/pretty-dom.d.ts +37 -0
- package/dist/testing-library/types/queries.d.ts +315 -0
- package/dist/testing-library/types/query-helpers.d.ts +112 -0
- package/dist/testing-library/types/role-helpers.d.ts +19 -0
- package/dist/testing-library/types/screen.d.ts +30 -0
- package/dist/testing-library/types/suggestions.d.ts +46 -0
- package/dist/testing-library/types/wait-for-element-to-be-removed.d.ts +6 -0
- package/dist/testing-library/types/wait-for.d.ts +12 -0
- package/dist/user-event/index.cjs +3923 -0
- package/dist/user-event/index.js +3898 -0
- package/dist/user-event/types/clipboard/copy.d.ts +2 -0
- package/dist/user-event/types/clipboard/cut.d.ts +2 -0
- package/dist/user-event/types/clipboard/index.d.ts +3 -0
- package/dist/user-event/types/clipboard/paste.d.ts +3 -0
- package/dist/user-event/types/convenience/click.d.ts +5 -0
- package/dist/user-event/types/convenience/hover.d.ts +4 -0
- package/dist/user-event/types/convenience/index.d.ts +3 -0
- package/dist/user-event/types/convenience/tab.d.ts +4 -0
- package/dist/user-event/types/ctrl-dom.d.ts +55 -0
- package/dist/user-event/types/document/UI.d.ts +35 -0
- package/dist/user-event/types/document/copySelection.d.ts +2 -0
- package/dist/user-event/types/document/getValueOrTextContent.d.ts +2 -0
- package/dist/user-event/types/document/index.d.ts +5 -0
- package/dist/user-event/types/document/interceptor.d.ts +20 -0
- package/dist/user-event/types/document/patchFocus.d.ts +7 -0
- package/dist/user-event/types/document/prepareDocument.d.ts +2 -0
- package/dist/user-event/types/document/trackValue.d.ts +13 -0
- package/dist/user-event/types/dom-types.d.ts +56 -0
- package/dist/user-event/types/event/behavior/click.d.ts +1 -0
- package/dist/user-event/types/event/behavior/cut.d.ts +1 -0
- package/dist/user-event/types/event/behavior/index.d.ts +8 -0
- package/dist/user-event/types/event/behavior/keydown.d.ts +1 -0
- package/dist/user-event/types/event/behavior/keypress.d.ts +1 -0
- package/dist/user-event/types/event/behavior/keyup.d.ts +1 -0
- package/dist/user-event/types/event/behavior/paste.d.ts +1 -0
- package/dist/user-event/types/event/behavior/registry.d.ts +9 -0
- package/dist/user-event/types/event/createEvent.d.ts +8 -0
- package/dist/user-event/types/event/dispatchEvent.d.ts +6 -0
- package/dist/user-event/types/event/eventMap.d.ts +265 -0
- package/dist/user-event/types/event/focus.d.ts +6 -0
- package/dist/user-event/types/event/index.d.ts +7 -0
- package/dist/user-event/types/event/input.d.ts +3 -0
- package/dist/user-event/types/event/radio.d.ts +5 -0
- package/dist/user-event/types/event/selection/getInputRange.d.ts +6 -0
- package/dist/user-event/types/event/selection/getTargetTypeAndSelection.d.ts +11 -0
- package/dist/user-event/types/event/selection/index.d.ts +15 -0
- package/dist/user-event/types/event/selection/modifySelection.d.ts +9 -0
- package/dist/user-event/types/event/selection/modifySelectionPerMouse.d.ts +8 -0
- package/dist/user-event/types/event/selection/moveSelection.d.ts +5 -0
- package/dist/user-event/types/event/selection/resolveCaretPosition.d.ts +9 -0
- package/dist/user-event/types/event/selection/selectAll.d.ts +6 -0
- package/dist/user-event/types/event/selection/setSelection.d.ts +11 -0
- package/dist/user-event/types/event/selection/setSelectionPerMouse.d.ts +9 -0
- package/dist/user-event/types/event/selection/setSelectionRange.d.ts +7 -0
- package/dist/user-event/types/event/selection/updateSelectionOnFocus.d.ts +6 -0
- package/dist/user-event/types/event/types.d.ts +21 -0
- package/dist/user-event/types/event/wrapEvent.d.ts +2 -0
- package/dist/user-event/types/index.d.ts +6 -0
- package/dist/user-event/types/keyboard/index.d.ts +3 -0
- package/dist/user-event/types/keyboard/keyMap.d.ts +5 -0
- package/dist/user-event/types/keyboard/parseKeyDef.d.ts +17 -0
- package/dist/user-event/types/options.d.ts +121 -0
- package/dist/user-event/types/pointer/index.d.ts +29 -0
- package/dist/user-event/types/pointer/keyMap.d.ts +2 -0
- package/dist/user-event/types/pointer/parseKeyDef.d.ts +6 -0
- package/dist/user-event/types/setup/api.d.ts +23 -0
- package/dist/user-event/types/setup/directApi.d.ts +25 -0
- package/dist/user-event/types/setup/dtl.d.ts +20 -0
- package/dist/user-event/types/setup/index.d.ts +22 -0
- package/dist/user-event/types/setup/setup.d.ts +45 -0
- package/dist/user-event/types/setup/wrapAsync.d.ts +4 -0
- package/dist/user-event/types/system/index.d.ts +13 -0
- package/dist/user-event/types/system/keyLocation.d.ts +11 -0
- package/dist/user-event/types/system/keyboard.d.ts +46 -0
- package/dist/user-event/types/system/pointer/buttons.d.ts +25 -0
- package/dist/user-event/types/system/pointer/device.d.ts +8 -0
- package/dist/user-event/types/system/pointer/index.d.ts +21 -0
- package/dist/user-event/types/system/pointer/mouse.d.ts +31 -0
- package/dist/user-event/types/system/pointer/pointer.d.ts +32 -0
- package/dist/user-event/types/system/pointer/shared.d.ts +21 -0
- package/dist/user-event/types/utility/clear.d.ts +3 -0
- package/dist/user-event/types/utility/index.d.ts +4 -0
- package/dist/user-event/types/utility/selectOptions.d.ts +4 -0
- package/dist/user-event/types/utility/type.d.ts +10 -0
- package/dist/user-event/types/utility/upload.d.ts +6 -0
- package/dist/user-event/types/utils/click/isClickableInput.d.ts +17 -0
- package/dist/user-event/types/utils/dataTransfer/Blob.d.ts +4 -0
- package/dist/user-event/types/utils/dataTransfer/Clipboard.d.ts +12 -0
- package/dist/user-event/types/utils/dataTransfer/DataTransfer.d.ts +3 -0
- package/dist/user-event/types/utils/dataTransfer/FileList.d.ts +2 -0
- package/dist/user-event/types/utils/edit/isContentEditable.d.ts +8 -0
- package/dist/user-event/types/utils/edit/isEditable.d.ts +26 -0
- package/dist/user-event/types/utils/edit/maxLength.d.ts +16 -0
- package/dist/user-event/types/utils/edit/setFiles.d.ts +11 -0
- package/dist/user-event/types/utils/edit/timeValue.d.ts +5 -0
- package/dist/user-event/types/utils/focus/cursor.d.ts +5 -0
- package/dist/user-event/types/utils/focus/getActiveElement.d.ts +3 -0
- package/dist/user-event/types/utils/focus/getTabDestination.d.ts +2 -0
- package/dist/user-event/types/utils/focus/isFocusable.d.ts +2 -0
- package/dist/user-event/types/utils/focus/selection.d.ts +9 -0
- package/dist/user-event/types/utils/focus/selector.d.ts +1 -0
- package/dist/user-event/types/utils/index.d.ts +29 -0
- package/dist/user-event/types/utils/keyDef/readNextDescriptor.d.ts +21 -0
- package/dist/user-event/types/utils/misc/cloneEvent.d.ts +2 -0
- package/dist/user-event/types/utils/misc/findClosest.d.ts +2 -0
- package/dist/user-event/types/utils/misc/getDocumentFromNode.d.ts +2 -0
- package/dist/user-event/types/utils/misc/getTreeDiff.d.ts +2 -0
- package/dist/user-event/types/utils/misc/getWindow.d.ts +2 -0
- package/dist/user-event/types/utils/misc/isDescendantOrSelf.d.ts +2 -0
- package/dist/user-event/types/utils/misc/isDisabled.d.ts +2 -0
- package/dist/user-event/types/utils/misc/isElementType.d.ts +6 -0
- package/dist/user-event/types/utils/misc/isVisible.d.ts +2 -0
- package/dist/user-event/types/utils/misc/level.d.ts +9 -0
- package/dist/user-event/types/utils/misc/wait.d.ts +6 -0
- package/dist/user-event/types/utils/pointer/cssPointerEvents.d.ts +4 -0
- package/dist/vitest-environment/failure-snapshot.js +42 -0
- package/dist/vitest-environment/index.js +185 -0
- package/dist/vitest-environment/plugin.js +90 -0
- package/dist/vitest-environment/types/failure-snapshot.d.ts +1 -0
- package/dist/vitest-environment/types/index.d.ts +29 -0
- package/dist/vitest-environment/types/plugin.d.ts +33 -0
- package/jest-preset.cjs +17 -0
- package/package.json +178 -4
package/README.md
CHANGED
|
@@ -1,3 +1,363 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ctrl/dom
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A DOM for testing React components. It replaces jsdom or happy-dom, and ships its own Testing
|
|
4
|
+
Library, user-event and jest-dom built on it. A 100-file React suite runs in 3.6 s with the whole
|
|
5
|
+
stack against 14.4 s on jsdom and 9.3 s on happy-dom, in less memory than either.
|
|
6
|
+
|
|
7
|
+
- **Drop-in.** Same globals as jsdom, and Testing Library implementations with the same
|
|
8
|
+
exports, behavior, error messages and `prettyDOM` output as `@testing-library/dom`, `/react`,
|
|
9
|
+
`/user-event` and `/jest-dom`. Swap only the DOM, or the whole stack, without touching tests.
|
|
10
|
+
- **Fast.** Queries like `getByRole` take microseconds instead of milliseconds, user-event
|
|
11
|
+
doesn't wait on timers between keystrokes, and idle time in `findBy*`, `waitFor` and app
|
|
12
|
+
debounces is skipped on a virtual clock instead of waited out ([turning it off](#time-skipping)).
|
|
13
|
+
- **Built for component tests.** No layout, no script execution, no navigation, no network;
|
|
14
|
+
everything else a React component touches behaves like a browser, or like jsdom where test
|
|
15
|
+
suites depend on it.
|
|
16
|
+
|
|
17
|
+
| | Supported |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| Node | 26+ |
|
|
20
|
+
| Test runner | Vitest 5+, Jest 30+, node:test, Bun |
|
|
21
|
+
| React | 19 (`@ctrl/dom/react` uses `React.act`) |
|
|
22
|
+
|
|
23
|
+
node:test and Bun: [Other test runners](#other-test-runners).
|
|
24
|
+
|
|
25
|
+
## Vitest
|
|
26
|
+
|
|
27
|
+
Whole stack: the environment plus your existing `@testing-library/*` imports routed to
|
|
28
|
+
`@ctrl/dom`.
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
pnpm add -D @ctrl/dom
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
// vitest.config.ts
|
|
36
|
+
import { defineConfig } from "vitest/config";
|
|
37
|
+
import { ctrlDom } from "@ctrl/dom/vitest";
|
|
38
|
+
|
|
39
|
+
export default defineConfig({
|
|
40
|
+
plugins: [ctrlDom()],
|
|
41
|
+
// Optional and faster: each test file gets a fresh context in a reused worker instead of a
|
|
42
|
+
// new worker, so per-file setup drops from about 23 ms to about 2 ms.
|
|
43
|
+
test: { pool: "vmThreads" },
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
DOM only (stock Testing Library packages keep working):
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
export default defineConfig({ plugins: [ctrlDom({ testingLibrary: false })] });
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Options go to the plugin: `ctrlDom({ url: "http://localhost:3000/", width: 1280 })`. With the
|
|
54
|
+
plugin installed, a file can also pick the environment itself: `// @vitest-environment ctrl-dom`.
|
|
55
|
+
An `environment` you set in the config other than `"ctrl-dom"` stays the project's default.
|
|
56
|
+
|
|
57
|
+
The plugin also adds a Node flag to Vitest's workers, since the default pool starts one per test
|
|
58
|
+
file: with its Testing Library it turns the compile cache on as each worker starts, so Vitest's
|
|
59
|
+
own worker modules load from it too, not only the DOM.
|
|
60
|
+
|
|
61
|
+
## Jest
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
pnpm add -D @ctrl/dom @ctrl/dom-jest-environment
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
// jest.config.js
|
|
69
|
+
module.exports = {
|
|
70
|
+
preset: "@ctrl/dom", // the environment + @testing-library/* routed to @ctrl/dom
|
|
71
|
+
setupFilesAfterEnv: ["@ctrl/dom/jest-dom"], // instead of "@testing-library/jest-dom"
|
|
72
|
+
};
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
DOM only: `testEnvironment: "@ctrl/dom-jest-environment"` (stock Testing Library keeps working).
|
|
76
|
+
Options go in `testEnvironmentOptions`. Per file: `/** @jest-environment @ctrl/dom-jest-environment */`.
|
|
77
|
+
|
|
78
|
+
## Other test runners
|
|
79
|
+
|
|
80
|
+
`@ctrl/dom/register` installs a window as the global for runners without a DOM environment, like
|
|
81
|
+
happy-dom's `@happy-dom/global-registrator`, with the Vitest environment's defaults: the
|
|
82
|
+
`jsdom-30` profile, `http://localhost:3000/`, idle time skipped on a virtual clock, and exceptions
|
|
83
|
+
thrown by event listeners failing the running test. Testing Library's automatic `cleanup()` after
|
|
84
|
+
each test works under both runners below, stock `@testing-library/react` included.
|
|
85
|
+
|
|
86
|
+
### node:test
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
node --import @ctrl/dom/register --test
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
or `import "@ctrl/dom/register";` as the first import of a test file. node:test's hooks are not
|
|
93
|
+
globals, so it exposes them as `beforeAll`, `afterAll`, `beforeEach` and `afterEach` (only names
|
|
94
|
+
not already defined), the way Jest and Bun do: that is what Testing Library looks for. After the
|
|
95
|
+
last test it closes the window and drops its pending timers, so a forgotten `setInterval` does not
|
|
96
|
+
keep the file's process running. Files get a fresh window each since node:test runs every file in
|
|
97
|
+
its own process; with `--test-isolation=none` they share one.
|
|
98
|
+
|
|
99
|
+
The jest-dom matchers need an `expect`. Jest's standalone [`expect`](https://www.npmjs.com/package/expect)
|
|
100
|
+
takes them as is; with `node:assert`, assert on DOM properties:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
// signup.test.ts
|
|
104
|
+
import assert from "node:assert/strict";
|
|
105
|
+
import { test } from "node:test";
|
|
106
|
+
import { expect } from "expect";
|
|
107
|
+
import * as matchers from "@ctrl/dom/jest-dom/matchers";
|
|
108
|
+
import { createElement } from "react";
|
|
109
|
+
import { render, screen } from "@ctrl/dom/react";
|
|
110
|
+
import userEvent from "@ctrl/dom/user-event";
|
|
111
|
+
import { Signup } from "./signup.ts";
|
|
112
|
+
|
|
113
|
+
expect.extend(matchers);
|
|
114
|
+
|
|
115
|
+
test("signs up", async () => {
|
|
116
|
+
const user = userEvent.setup();
|
|
117
|
+
render(createElement(Signup));
|
|
118
|
+
assert.equal((screen.getByRole("button", { name: "Sign up" }) as HTMLButtonElement).disabled, true);
|
|
119
|
+
await user.type(screen.getByLabelText("Name"), "Ada");
|
|
120
|
+
expect(screen.getByRole("textbox", { name: "Name" })).toHaveValue("Ada");
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Node strips TypeScript types but does not compile JSX: write `.ts` files with `createElement`, or
|
|
125
|
+
add a loader such as [tsx](https://www.npmjs.com/package/tsx) for `.tsx` files
|
|
126
|
+
(`node --import tsx --import @ctrl/dom/register --test`, with `"jsx": "react-jsx"` in your
|
|
127
|
+
tsconfig.json).
|
|
128
|
+
|
|
129
|
+
### Bun
|
|
130
|
+
|
|
131
|
+
```toml
|
|
132
|
+
# bunfig.toml
|
|
133
|
+
[test]
|
|
134
|
+
preload = ["@ctrl/dom/register"]
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
// signup.test.tsx
|
|
139
|
+
import { expect, test } from "bun:test";
|
|
140
|
+
import * as matchers from "@ctrl/dom/jest-dom/matchers";
|
|
141
|
+
import { render, screen } from "@ctrl/dom/react";
|
|
142
|
+
import userEvent from "@ctrl/dom/user-event";
|
|
143
|
+
import { Signup } from "./signup.tsx";
|
|
144
|
+
|
|
145
|
+
expect.extend(matchers);
|
|
146
|
+
|
|
147
|
+
test("signs up", async () => {
|
|
148
|
+
const user = userEvent.setup();
|
|
149
|
+
render(<Signup />);
|
|
150
|
+
expect(screen.getByRole("button", { name: "Sign up" })).toBeDisabled();
|
|
151
|
+
await user.type(screen.getByLabelText("Name"), "Ada");
|
|
152
|
+
expect(screen.getByRole("textbox", { name: "Name" })).toHaveValue("Ada");
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
`bun test` runs every file in one global, so files share the window (like Vitest with
|
|
157
|
+
`isolate: false`); `bun test --isolate` (or `--parallel`) gives every file a fresh global and
|
|
158
|
+
window. Bun's own test hooks are already globals.
|
|
159
|
+
|
|
160
|
+
### Configuration
|
|
161
|
+
|
|
162
|
+
A preload takes no arguments, so it reads `CTRL_DOM_URL`, `CTRL_DOM_COMPAT` (`jsdom-26`, `jsdom-30`,
|
|
163
|
+
`modern`), `CTRL_DOM_TIME_SKIP` (`0`/`1`) and `CTRL_DOM_TEST_HOOKS=0` (leave the runner alone).
|
|
164
|
+
Anything else goes through the API, which `@ctrl/dom/register/pure` exports without registering
|
|
165
|
+
on import:
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
import { register, unregister } from "@ctrl/dom/register/pure";
|
|
169
|
+
|
|
170
|
+
const { window } = register({ url: "http://localhost:5173/", compat: "modern", width: 1280 });
|
|
171
|
+
// ...
|
|
172
|
+
unregister(); // closes the window and restores every global it replaced
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
`register(options)` takes the [environment options](#options) (except `compileCache` and
|
|
176
|
+
`nodeFetch`) plus `testHooks` (default `false` here, `true` for `@ctrl/dom/register`), and replaces
|
|
177
|
+
any previous registration.
|
|
178
|
+
|
|
179
|
+
### Storybook
|
|
180
|
+
|
|
181
|
+
[Portable stories](https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest) run
|
|
182
|
+
under the ctrl-dom Vitest environment, and under node:test or Bun with `@ctrl/dom/register`:
|
|
183
|
+
`composeStories` stories render with `@ctrl/dom/react`'s `render`, and `await Story.run()` mounts
|
|
184
|
+
the story and runs its `play` function (Storybook's `storybook/test` brings its own Testing Library
|
|
185
|
+
and user-event, which run on the same DOM).
|
|
186
|
+
|
|
187
|
+
```tsx
|
|
188
|
+
import { composeStories } from "@storybook/react";
|
|
189
|
+
import { render, screen } from "@ctrl/dom/react";
|
|
190
|
+
import * as stories from "./Signup.stories.tsx";
|
|
191
|
+
|
|
192
|
+
const { Empty, Filled } = composeStories(stories);
|
|
193
|
+
|
|
194
|
+
test("renders", () => {
|
|
195
|
+
render(<Empty />);
|
|
196
|
+
expect(screen.getByRole("button", { name: "Sign up" })).toBeDisabled();
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test("plays", async () => {
|
|
200
|
+
await Filled.run();
|
|
201
|
+
expect(screen.getByRole("status")).toHaveTextContent("Hi, Ada!");
|
|
202
|
+
});
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
`run()` leaves its canvas in the document after the test, as on jsdom: Testing Library's `cleanup()`
|
|
206
|
+
does not remove it, so a later test in the same file sees both (duplicate `id`s break label
|
|
207
|
+
lookups). Where test hooks are global (Jest, Bun, node:test with the register), importing
|
|
208
|
+
Testing Library's React entry turns React's act environment on, and React then warns about `play`
|
|
209
|
+
functions' state updates outside `act(...)`; the tests still pass.
|
|
210
|
+
|
|
211
|
+
## Time skipping
|
|
212
|
+
|
|
213
|
+
Timers run on a virtual clock. Whenever a test has nothing left to do but wait (no pending
|
|
214
|
+
promises, `setImmediate` callbacks or I/O), the clock jumps to the next timer, and `Date`,
|
|
215
|
+
`performance.now()` and event timestamps move with it. A `findBy*` waiting out an 800 ms debounce
|
|
216
|
+
returns in microseconds; timers still fire in order, and fake timers (`vi.useFakeTimers()`,
|
|
217
|
+
`jest.useFakeTimers()`) take over as usual.
|
|
218
|
+
|
|
219
|
+
Turn it off when a test needs real time to pass: a timer from `node:timers`, or from a library
|
|
220
|
+
that grabbed `setTimeout` before the environment started, racing the page's timers; or a test
|
|
221
|
+
measuring time against a clock outside the process. Real I/O (sockets, files, child processes)
|
|
222
|
+
already holds the clock, so a real server's latency is never skipped.
|
|
223
|
+
|
|
224
|
+
| Scope | How |
|
|
225
|
+
| --- | --- |
|
|
226
|
+
| Vitest, every file | `ctrlDom({ timeSkip: false })` |
|
|
227
|
+
| Vitest, one file | `// @vitest-environment-options {"timeSkip": false}` as its first line |
|
|
228
|
+
| Jest, every file | `testEnvironmentOptions: { timeSkip: false }` |
|
|
229
|
+
| Jest, one file | `/** @jest-environment-options {"timeSkip": false} */` at the top |
|
|
230
|
+
| node:test, Bun | `register({ timeSkip: false })` from `@ctrl/dom/register/pure` |
|
|
231
|
+
| Any runner, one run | `CTRL_DOM_TIME_SKIP=0`, which overrides the option |
|
|
232
|
+
|
|
233
|
+
## Direct imports
|
|
234
|
+
|
|
235
|
+
| Instead of | Import |
|
|
236
|
+
| --- | --- |
|
|
237
|
+
| `@testing-library/react` | `@ctrl/dom/react` (also `/react/pure`, `/react/dont-cleanup-after-each`) |
|
|
238
|
+
| `@testing-library/dom` | `@ctrl/dom/testing-library` |
|
|
239
|
+
| `@testing-library/user-event` | `@ctrl/dom/user-event` |
|
|
240
|
+
| `@testing-library/jest-dom` | `@ctrl/dom/jest-dom` (also `/jest-dom/vitest`, `/jest-dom/matchers`, `/jest-dom/jest-globals`) |
|
|
241
|
+
| `aria-query` + `dom-accessibility-api` | `@ctrl/dom/aria` |
|
|
242
|
+
| `jsdom` / `happy-dom` | `@ctrl/dom` (`createWindow()`, `installGlobals(window)`) |
|
|
243
|
+
| `@happy-dom/global-registrator` | `@ctrl/dom/register` (`register()`, `unregister()` from `/register/pure`) |
|
|
244
|
+
|
|
245
|
+
Under either environment, `@ctrl/dom` and every subpath share the environment's DOM instance,
|
|
246
|
+
in Jest and in every Vitest pool (including `vmThreads`/`vmForks`), so `instanceof` checks against
|
|
247
|
+
`@ctrl/dom`'s classes hold. The same goes for the window `@ctrl/dom/register` installs.
|
|
248
|
+
|
|
249
|
+
## Options
|
|
250
|
+
|
|
251
|
+
Environment options (`environmentOptions["ctrl-dom"]` in Vitest, `testEnvironmentOptions` in
|
|
252
|
+
Jest):
|
|
253
|
+
|
|
254
|
+
| Option | Default | |
|
|
255
|
+
| --- | --- | --- |
|
|
256
|
+
| `url` | `http://localhost:3000/` (Vitest), `http://localhost/` (Jest) | document URL |
|
|
257
|
+
| `width`, `height` | 1024 × 768 | `innerWidth` / `innerHeight`, drives `matchMedia` |
|
|
258
|
+
| `userAgent`, `platform`, `languages`, `devicePixelRatio`, `referrer` | jsdom-like | navigator / window values |
|
|
259
|
+
| `timeSkip` | `true` | skip idle time on a virtual clock; `false` keeps real-time timers. `CTRL_DOM_TIME_SKIP=0/1` overrides |
|
|
260
|
+
| `compat` | `"jsdom-30"` (Vitest), `"jsdom-26"` (Jest) | which APIs beyond jsdom's are exposed: see below |
|
|
261
|
+
| `layout` | off | `"lite"`: an approximate box model for geometry (`getBoundingClientRect`, `offset*`, `client*`, `scroll*`, ResizeObserver), so virtualizers (TanStack Virtual, react-window) and positioning libraries work without hand-written mocks. Off, geometry is zeros as in jsdom. Details: [docs/layout.md](https://github.com/scttcper/dom/blob/main/docs/layout.md) |
|
|
262
|
+
| `compileCache` (Vitest) | `true` with the plugin's Testing Library, else `false` | enable Node's compile cache before importing the DOM (with the plugin: as each worker starts), for every worker after the first. It stays on for everything the worker loads, which only pays off for large files (stock Testing Library's many small ones load slower). `CTRL_DOM_COMPILE_CACHE=0/1` overrides |
|
|
263
|
+
| `nodeFetch` (Jest) | `false` | keep Node's `fetch`/`Request`/`Response` (absent under jest-environment-jsdom) |
|
|
264
|
+
|
|
265
|
+
## Compat profiles
|
|
266
|
+
|
|
267
|
+
Suites written for jsdom feature-detect: a library that finds `PointerEvent`, `matchMedia` or
|
|
268
|
+
`ResizeObserver` takes its browser path, and a polyfill that installs itself only when an API is
|
|
269
|
+
missing leaves ours in place instead of its mock. `compat` picks what the test global exposes:
|
|
270
|
+
|
|
271
|
+
| `compat` | Matches | Exposes beyond jsdom 30 |
|
|
272
|
+
| --- | --- | --- |
|
|
273
|
+
| `"jsdom-26"` | jest-environment-jsdom 30 (jsdom 26.1); the Jest default | no `PointerEvent` or `onpointer*` handlers |
|
|
274
|
+
| `"jsdom-30"` | Vitest's jsdom environment; the Vitest default | nothing libraries feature-detect |
|
|
275
|
+
| `"modern"` | everything @ctrl/dom implements | `matchMedia`, `ResizeObserver`, the `inert` IDL attribute, `visualViewport` |
|
|
276
|
+
|
|
277
|
+
[docs/deviations.md](https://github.com/scttcper/dom/blob/main/docs/deviations.md) lists every API in
|
|
278
|
+
each profile, with the reason.
|
|
279
|
+
|
|
280
|
+
## Debugging with coding agents
|
|
281
|
+
|
|
282
|
+
`screen.debug()` and failing queries print the whole DOM as HTML, which costs an agent thousands
|
|
283
|
+
of tokens of classes and SVG paths. Run tests with `CTRL_DOM_DEBUG=aria` (or
|
|
284
|
+
`ctrlDom({ debug: "aria" })`) to print the accessibility tree in Playwright's aria snapshot
|
|
285
|
+
format instead, plus the closest matches when a `*ByRole`, `*ByText` or `*ByLabelText` query
|
|
286
|
+
fails:
|
|
287
|
+
|
|
288
|
+
```
|
|
289
|
+
Unable to find an accessible element with the role "button" and name "Submit"
|
|
290
|
+
|
|
291
|
+
Closest matches:
|
|
292
|
+
- text: "Submit" # in <div>, which has no role: give it role="button" or use getByText
|
|
293
|
+
- button "Pay now" # same role, other name
|
|
294
|
+
|
|
295
|
+
Accessibility snapshot of <body> (CTRL_DOM_DEBUG=aria):
|
|
296
|
+
- main:
|
|
297
|
+
- heading "Checkout" [level=1]
|
|
298
|
+
- form "Payment":
|
|
299
|
+
- textbox "Email address"
|
|
300
|
+
- button "Pay now"
|
|
301
|
+
- text: Submit
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
That error is 468 characters; upstream prints 2,476 for the same small form, and around 437,000
|
|
305
|
+
for a large page. `ariaSnapshot(el?)` / `screen.ariaSnapshot()`, `prettyDOM(el, max, { format: "aria" })`
|
|
306
|
+
and `diffAriaSnapshots(before, after)` are available directly. `CTRL_DOM_DEBUG=compact` prints
|
|
307
|
+
HTML without class/style attributes and SVG internals. Without the variable, output is identical
|
|
308
|
+
to Testing Library's.
|
|
309
|
+
|
|
310
|
+
In the same mode, **every failing test** (a failed `toBe`, a thrown error, not just queries) ends
|
|
311
|
+
with a snapshot of the page as it was when it failed, before cleanup, plus what changed since the
|
|
312
|
+
test's previous snapshot. Jest's environment does this on its own; with Vitest, `ctrlDom()` adds
|
|
313
|
+
the setup file, or add `"@ctrl/dom/vitest-environment/failure-snapshot"` to `setupFiles` with the
|
|
314
|
+
bare environment.
|
|
315
|
+
|
|
316
|
+
`npx ctrl-dom debug <test file> [-t name]` does all of it in one command: it finds Vitest or Jest,
|
|
317
|
+
runs just that file in agent mode and prints a compact report (failures with their snapshot and
|
|
318
|
+
closest matches, one stack frame, console output), exiting with the test's status.
|
|
319
|
+
|
|
320
|
+
To assert structure the way the snapshot prints it, jest-dom gets
|
|
321
|
+
`expect(el).toMatchAriaSnapshot(template)`, with
|
|
322
|
+
[Playwright's](https://playwright.dev/docs/aria-snapshots) partial matching:
|
|
323
|
+
|
|
324
|
+
```ts
|
|
325
|
+
expect(screen.getByRole("form")).toMatchAriaSnapshot(`
|
|
326
|
+
- textbox "Email"
|
|
327
|
+
- button /Pay \\d+ €/ [disabled]
|
|
328
|
+
`);
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
A line for your `CLAUDE.md` / `AGENTS.md`:
|
|
332
|
+
|
|
333
|
+
> When a component test fails, rerun it with `npx ctrl-dom debug <file> [-t <name>]` and read the
|
|
334
|
+
> accessibility snapshot and closest matches instead of adding `screen.debug()`.
|
|
335
|
+
|
|
336
|
+
Details: [docs/agent-debugging.md](https://github.com/scttcper/dom/blob/main/docs/agent-debugging.md).
|
|
337
|
+
|
|
338
|
+
## Sentry
|
|
339
|
+
|
|
340
|
+
[`@ctrl/sentry-tests`](https://www.npmjs.com/package/@ctrl/sentry-tests) puts test runs in Sentry:
|
|
341
|
+
failing tests as issues with the failing line, what the test did as breadcrumbs and the page
|
|
342
|
+
attached, flaky tests as `FlakyTest` issues, and each test file as a trace of its describe blocks,
|
|
343
|
+
tests, hooks and test functions. On @ctrl/dom the traces also hold every Testing Library query,
|
|
344
|
+
`waitFor`, user-event action and render (`findByRole("option", …) (40 checks)`), and failures get
|
|
345
|
+
an accessibility snapshot of the page.
|
|
346
|
+
|
|
347
|
+
```ts
|
|
348
|
+
plugins: [ctrlDom(), sentryTests()] // Vitest, sentryTests from @ctrl/sentry-tests/vitest
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
Setup for Vitest and Jest:
|
|
352
|
+
[its README](https://github.com/scttcper/dom/blob/main/packages/sentry-tests/README.md).
|
|
353
|
+
|
|
354
|
+
## Differences from jsdom
|
|
355
|
+
|
|
356
|
+
There is no script execution, no navigation and no network, as in jsdom and happy-dom, and no
|
|
357
|
+
layout unless you turn on `layout: "lite"` (otherwise geometry is zeros, as in jsdom). Every
|
|
358
|
+
intentional difference is listed, with the reason, in [docs/deviations.md](https://github.com/scttcper/dom/blob/main/docs/deviations.md).
|
|
359
|
+
|
|
360
|
+
## License
|
|
361
|
+
|
|
362
|
+
MIT. Includes code ported from Testing Library, dom-accessibility-api, aria-query, Playwright,
|
|
363
|
+
jsdom and others; their copyright notices and licenses are in the package's `NOTICE` file.
|