# Extension points — chaijs/chai

> Canonical page: https://codevetter.com/unpack/chai/extension-points

# Extension points — chaijs/chai

Scanned commit d86de2a9519bdd0d89aa64c9fbcc0e880513b153 (2026-09-29). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

Extensions enter through use and Assertion's registration helpers rather than a router or service registry. New behavior can be implemented as properties, methods, or callable chain properties, with corresponding overwrite mechanisms. Flags carry custom state and registration events expose extension activity. Configuration supplies additional hooks for comparison and diagnostics.
- use(fn) is the plugin entrypoint: callbacks receive the constructed Chai exports object and util, installations are deduplicated by function identity, and returned exports support chained use calls. — [lib/chai.js#L29-L34](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai.js#L29-L34) [lib/chai.js#L48-L65](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai.js#L48-L65)
- Assertion.addProperty delegates to a configurable prototype getter; the getter can return a custom result or continue the assertion chain automatically. — [lib/chai/assertion.js#L93-L99](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/assertion.js#L93-L99) [lib/chai/utils/addProperty.js#L38-L72](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/addProperty.js#L38-L72)
- Assertion.addMethod wraps arbitrary methods with stack-marker management, continuation, length guards, and proxy diagnostics for uncalled methods. — [lib/chai/assertion.js#L101-L107](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/assertion.js#L101-L107) [lib/chai/utils/addMethod.js#L40-L75](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/addMethod.js#L40-L75)
- Assertion.addChainableMethod separates access-time chainingBehavior from call-time method behavior and stores both in ctx.__methods[name] for later replacement. — [lib/chai/assertion.js#L109-L116](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/assertion.js#L109-L116) [lib/chai/utils/addChainableMethod.js#L94-L112](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/addChainableMethod.js#L94-L112) [lib/chai/utils/addChainableMethod.js#L118-L147](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/addChainableMethod.js#L118-L147)
- Assertion exposes overwriteProperty, overwriteMethod, and overwriteChainableMethod; overwriteMethod passes the previous implementation to the replacement factory and temporarily locks stack markers. — [lib/chai/assertion.js#L118-L141](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/assertion.js#L118-L141) [lib/chai/utils/overwriteMethod.js#L47-L54](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/overwriteMethod.js#L47-L54) [lib/chai/utils/overwriteMethod.js#L72-L90](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/overwriteMethod.js#L72-L90)
- util.flag, transferFlags, and Assertion._obj let plugins read/change targets and carry custom metadata; transferFlags can preserve extension flags while excluding four base flags. — [lib/chai/utils/flag.js#L58-L65](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/flag.js#L58-L65) [lib/chai/utils/transferFlags.js#L39-L49](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/transferFlags.js#L39-L49) [lib/chai/assertion.js#L191-L202](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/assertion.js#L191-L202) [test/utilities.js#L38-L58](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/test/utilities.js#L38-L58)
- util.events is an EventTarget for registration notifications; method/property events carry name and fn, while chainable-method events also expose chainingBehavior. — [lib/chai/utils/index.js#L99-L100](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/index.js#L99-L100) [lib/chai/utils/events.js#L7-L20](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/events.js#L7-L20) [lib/chai/utils/addChainableMethod.js#L182-L188](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/addChainableMethod.js#L182-L188) [test/utilities.js#L1536-L1596](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/test/utilities.js#L1536-L1596)
- config.deepEqual supplies the comparator captured by new Assertions; useProxy and proxyExcludedKeys alter property diagnostics, while includeStack, showDiff, and truncateThreshold control failure presentation. — [lib/chai/config.js#L14-L111](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/config.js#L14-L111) [lib/chai/assertion.js#L51-L58](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/assertion.js#L51-L58) [lib/chai/utils/proxify.js#L34-L46](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/proxify.js#L34-L46) [lib/chai/utils/inspect.js#L23-L30](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/inspect.js#L23-L30)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
