# Data flow — chaijs/chai

> Canonical page: https://codevetter.com/unpack/chai/data-flow

# Data flow — 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.

Assertion input becomes a target reference plus metadata stored in flags. Chain getters and methods propagate those flags, while selected operations replace the target for subsequent assertions. Comparison results pass through a common negation and error-construction boundary. Outputs are continuing assertion objects, explicit return values, or thrown errors; inspected callback operations can also modify consumer-owned state.
- expect forwards its value and optional message to Assertion; construction records object, message, ssfi, lockSsfi, and the current configured deep comparator. — [lib/chai/interface/expect.js#L16-L18](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/interface/expect.js#L16-L18) [lib/chai/assertion.js#L51-L58](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/assertion.js#L51-L58)
- flag reads or writes __flags according to argument count; transferFlags copies flag values and can exclude object, ssfi, lockSsfi, and message. — [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#L28-L51](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/transferFlags.js#L28-L51)
- Property and method wrappers call the supplied implementation, preserve explicit results, and otherwise construct another Assertion populated with transferred flags. — [lib/chai/utils/addProperty.js#L58-L69](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/addProperty.js#L58-L69) [lib/chai/utils/addMethod.js#L57-L66](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/addMethod.js#L57-L66)
- Chainable getters first run chainingBehavior, then create a callable wrapper that inherits assertion properties, copies flags, and is proxified; calling it runs the stored method. — [lib/chai/utils/addChainableMethod.js#L110-L147](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/addChainableMethod.js#L110-L147) [lib/chai/utils/addChainableMethod.js#L150-L177](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/addChainableMethod.js#L150-L177)
- assertProperty resolves nested paths through getPathInfo or reads obj[name], checks existence and optional equality, then replaces the object flag with the resolved value. — [lib/chai/core/assertions.js#L1975-L2022](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/core/assertions.js#L1975-L2022) [lib/chai/utils/index.js#L41-L42](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/index.js#L41-L42)
- Assertion.assert sends the expression through util.test for negation, applies showDiff policy, derives message/actual/operator metadata, and throws AssertionError only on failure. — [lib/chai/assertion.js#L157-L183](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/assertion.js#L157-L183) [lib/chai/utils/test.js#L20-L24](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/test.js#L20-L24)
- getMessage selects positive or negative templates, evaluates function templates, replaces this/act/exp placeholders in one pass, and prefixes the custom message; display delegates to loupe and threshold-based summaries. — [lib/chai/utils/getMessage.js#L34-L54](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/getMessage.js#L34-L54) [lib/chai/utils/objDisplay.js#L23-L49](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/objDisplay.js#L23-L49) [lib/chai/utils/inspect.js#L23-L30](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/utils/inspect.js#L23-L30)
- change reads a subject before and after invoking the target function, stores delta metadata in flags, and leaves the consumer's resulting state in place; by reads those stored values without invoking the callback again. — [lib/chai/core/assertions.js#L3532-L3567](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/core/assertions.js#L3532-L3567) [lib/chai/core/assertions.js#L3882-L3902](https://github.com/chaijs/chai/blob/d86de2a9519bdd0d89aa64c9fbcc0e880513b153/lib/chai/core/assertions.js#L3882-L3902)

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)
