CodeVetter · Repo Unpack · System map
chaijs/chai
The runtime consists of a shared Assertion class, built-in registrations, three public interfaces, and utility functions. Module evaluation installs the core assertions, while consumers explicitly activate plugins or the should prototype accessor. State is held in assertion objects and module-level configuration and registries. Distribution is a generated ESM bundle with separate global-registration modules.
- package.json declares ESM, Node >=18, main ./index.js, and a publish file list containing index.js and register-*.js.
- lib/chai.js imports core/assertions.js for registration side effects and exports Assertion, AssertionError, config, util, expect, assert, should, and Should.
- Assertion owns per-chain __flags, initializes target/message/stack/comparator state, and returns a proxified instance.
- The utility facade delegates deep equality to deep-eql, nested lookup to pathval, error matching to check-error, and value inspection to loupe.
- The inspected state owners are in-memory: config is an exported object, use retains a used-plugin array, and events is a module-level EventTarget.
- build bundles lib/chai.js into index.js as ES2021 ESM with names preserved; prebuild runs clean, whose command deletes index.js and coverage/.
- Lint combines ESLint and Prettier checks over lib; lint:types separately invokes strict, no-emit JavaScript checking through TypeScript.
- Release creation triggers a build/test job followed by a dependent npm publishing job that enables OIDC, applies github.ref_name as the version, and requests public publication with provenance.