Momo's Blog

Talk is cheap. Show me the code.

Javascript & Nodejs test note

TL;DR

  • If you want to “just get started” or looking for a fast framework for large projects, go with Jest.
  • If you want a very flexible and extendable configuration, go with Mocha.
  • If you are looking for simplicity go with Ava.
  • If you want to be really low-level, go with tape.

Test framework/library

  • Mocha - the fun, simple, flexible JavaScript test framework.
  • Jest - Delightful JavaScript Testing.
  • tape - npm - tap-producing test harness for node and browsers.
  • tape-promise - Promise and ES2016 (ES7)async/awaitsupport for- Tape.
  • supertest: Super-agent driven library for testing node.js HTTP servers using a fluent API.

Assertion library

Mock tools

  • node-mocks-http- Mock ‘http’ objects for testing Express routing functions.
  • Sinon.JS - Standalone test fakes, spies, stubs and mocks for JavaScript. Works with any unit testing framework.
  • nock : HTTP server mocking and expectations library for Node.js
  • faker.js : generate massive amounts of realistic fake data in Node.js and the browser

ESlint plugin

property-based testing

  • JSVerify - property based testing for JavaScript. Like QuickCheck.
  • TestCheck.js - Generative property testing for JavaScript.
  • fast-check - Property based testing framework for JavaScript (like QuickCheck) written in TypeScript.

analysis code

  • SonarQube - Continuous Inspection, Continuous Code Quality.
  • Code Climate - process insights and automated code review.
  • chaosmonkey - Chaos Monkey is a resiliency tool that helps applications tolerate random instance failures.
  • kube-monkey - An implementation of Netflix’s Chaos Monkey for Kubernetes clusters.

mutation testing

License check

audit dependencies