{"id":25063,"library":"chai-parentheses","title":"chai-parentheses","description":"Chai plugin that converts terminating property assertions (true, false, null, etc.) into function-call form to avoid lint errors and ensure assertions are actually executed. v0.0.2 is the latest stable version, released as a maintenance fork of dirty-chai that works with modern bundlers (ESM/CJS compatibility). Key differentiator vs. dirty-chai: fixes bundler issues without changing API. Supports custom error messages and works with other Chai plugins when loaded first. Ships TypeScript types.","status":"active","version":"0.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/achingbrain/dirty-chai","tags":["javascript","chai","chai-plugin","browser","testing","typescript"],"install":[{"cmd":"npm install chai-parentheses","lang":"bash","label":"npm"},{"cmd":"yarn add chai-parentheses","lang":"bash","label":"yarn"},{"cmd":"pnpm add chai-parentheses","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency - plugin requires Chai to be installed","package":"chai","optional":false}],"imports":[{"note":"Default export is the plugin function. CJS require also works in Node.","wrong":"const parentheses = require('chai-parentheses')","symbol":"default","correct":"import parentheses from 'chai-parentheses'"},{"note":"Do not call parentheses as a function; pass the plugin reference.","wrong":"chai.use(parentheses())","symbol":"chai.use","correct":"import { use } from 'chai'; use(parentheses)"},{"note":"After using chai-parentheses, terminate with () for assertions like true, false, null, undefined, exist, empty, ok, arguments.","wrong":"expect(true).to.be.true","symbol":"expect().to.be.true","correct":"expect(true).to.be.true()"}],"quickstart":{"code":"import { expect, use } from 'chai';\nimport parentheses from 'chai-parentheses';\n\nuse(parentheses);\n\ndescribe('example', () => {\n  it('works', () => {\n    expect(true).to.be.true();\n    expect(null).to.be.null();\n    expect({}).to.be.empty();\n  });\n});","lang":"typescript","description":"Demonstrates importing and using chai-parentheses with Chai's expect, including function-call form for terminators."},"warnings":[{"fix":"Place length/arguments assertions first in chain or use separate assertion statements.","message":"Chaining length/argument after other assertions breaks: myArray.should.exist.and.should.have.length(3) throws 'length is not a function'","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Load chai-as-promised first, then chai-parentheses, then other plugins like sinon-chai.","message":"Plugin must be loaded after chai-as-promised but before other plugins that add property assertions","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Always end with () for terminators: expect(true).to.be.true() or expect(true).to.be.true.and.not.false()","message":"The chain must always be terminated with a function call; otherwise prior assertions in the chain may not execute","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Replace dirty-chai with chai-parentheses in package.json and imports. API is identical.","message":"dirty-chai has known issues with modern bundlers (Webpack/Rollup); chai-parentheses is the recommended replacement","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use .length first: myArray.should.have.length(3).and.should.exist()","cause":"Using .length after another chained property assertion with parentheses","error":"Error: length is not a function"},{"fix":"Add parentheses: expect(true).to.be.true()","cause":"Forgetting to call the terminating function; property assertion never executed","error":"AssertionError: expected undefined to be truthy"},{"fix":"Correct: chai.use(parentheses); not chai.use(parentheses());","cause":"Passing parentheses() to chai.use instead of the plugin reference","error":"TypeError: chai.use is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}