0.1.2 • Published 10 years ago

tdfjs v0.1.2

Weekly downloads
8
License
MIT
Repository
github
Last release
10 years ago

tdfjs

tdfjs is an experimental runner-less TDD tool for JavaScript.

Install

With npm:

npm install tdfjs

Goals

  • Minimialistic. 2.2k minified/0.9k gziped.
  • No test-runner, evaluating the code verifies the behavior.
  • Suitable for testing front end prototypes, e.g. codepen.io, jsbin.com, jsfiddle.net.
  • Focuses tests the smallest unit of work a single function.
  • Syntax places emphasis on test-first approach.
  • Couples requirements and implemention.

Example

var add = tdf("A function that adds multiple numbers")
  .when(1,1).returns(2)
  .when(2,2).returns(4)
  .when(5,-1).returns(4)
  .when(1,1,1).returns(3)
  .when(1).returns(1)
  .when(0.5,0.5,1).returns(2)
  .define(function() {
    var sum = 0;
    for(var i = 0; i < arguments.length; i++) {
      sum += arguments[i];
    }
    return sum;
  });

Complements

  • Proclaim A fantastic, minimal assertion library.

Future thoughts

  • Test quality evaluation analyze tests cases/arguments and warn if there are cases where behavior is not defined.
  • Allow multiple function defintions that resolve a particular set of requirements, with the ability to swap between them.
  • Production switch that turns off all validation for higher performance at the obvious cost of validation.
0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago