> Mocha Test Framework
JavaScript/TypeScript testing with Mocha. BDD/TDD style describe/it blocks, hooks, and async tests.
fetch
$
curl "https://skillshub.wtf/skillshub-team/catalog-batch5/mocha-testing?format=md"SKILL.md•Mocha Test Framework
Mocha Testing
Setup
npm install -D mocha @types/mocha chai ts-node
.mocharc.yml
require: ts-node/register
spec: "test/**/*.test.ts"
timeout: 5000
recursive: true
Tests
import { expect } from 'chai';
describe('Calculator', () => {
let calc: Calculator;
beforeEach(() => { calc = new Calculator(); });
it('should add numbers', () => { expect(calc.add(2, 3)).to.equal(5); });
it('should throw on div by zero', () => {
expect(() => calc.divide(1, 0)).to.throw('Division by zero');
});
});
describe('API', () => {
it('should fetch data', async () => {
const data = await api.get('/users');
expect(data).to.be.an('array');
});
});
Hooks: before, after, beforeEach, afterEach
Run: npx mocha / npx mocha --grep "pattern" / npx mocha --watch
> related_skills --same-repo
> Nix Dev Shells with direnv
Auto-activate reproducible dev environments with Nix flakes and direnv.
> Dagger with GitHub Actions
Run Dagger CI/CD pipelines in GitHub Actions for portable, testable builds.
> Bun + Hono API
Build fast APIs with Bun runtime and Hono framework.
> Deno Fresh Framework
Build full-stack web apps with Fresh on Deno. Islands, routes, and zero runtime overhead.
┌ stats
installs/wk0
░░░░░░░░░░first seenMar 18, 2026
└────────────