A Chai plugin that converts terminating property assertions (e.g., .true, .ok) into function-call form (e.g., .true(), .ok()). This makes assertions lint-friendly (avoiding 'Expected an assignment or function call' warnings) and ensures assertions are actually invoked. Version 3.0.0 requires Chai >= 6.2.0 < 7. It works with browser and Node, and can adapt property assertions from other Chai plugins when loaded before them. Key differentiator: eliminates false positives from uninvoked property access.
npm install dirty-chaiNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Import and use dirty-chai with ESM, demonstrating function-call form for common assertions and custom error messages.
Update chai to version >=6.2.0 <7
Always terminate chains with a function call, e.g., .true()
Use .length or .arguments first in the chain, or separate into multiple assertions
Load chai-as-promised before dirty-chai, and dirty-chai before any other plugins
Use import dirtyChai from 'dirty-chai' instead of require('dirty-chai')Install dirty-chai and call chai.use(dirtyChai) before using function-form assertions.
Add parentheses to the assertion: .true() instead of .true
Use .length first in the chain or break into separate assertions.