QuickDevGuide

Home › Mocha JS Testing

Exclusive, Pending & Dynamic Tests — Mocha JS Testing

Feature Syntax Use Exclusive it.only, describe.only run just this while debugging Skip it.skip, describe.skip, this.skip() temporarily disable / skip at runtime Pending it("todo") with no callback placeholder shown as pending Dynamic for loop / forEach generating it calls table-driven tests Grep mocha --grep "Cart" / --fgrep run matching tests only Use --forbid-only in CI so a forgotten .only fails the build instead of silently skipping the rest of the suite. Table-driven tests keep many input/output cases readable and make adding a case a one-line change.

Key Takeaways