Adds on to mocha.js.
Provides a different way to implement
after() hook that properly cleans
itself up after every test run simplifying several common test patterns.
See the annotated source at http://gh.chakrit.net/mocha-subject/
var ms =TestObject = ;ms; // (optional) uses globoally.;
Compares this to proper manual setups/teardowns:
var ms =TestObject = ;;
- Assigns (and automatically removes on after()) an object to the test context with a single line of code instead of 6.
- Assigns (and automatically removes on after()) the property of any object added previously to the test context with the specified name with a single line of code instead of 6;
- Subject cleans up after itself, there is no need for an
afterblock just to make sure you don't leak variables to another test or setup stuff with conflicting names.
CONTRIBUTE / SUPPORT
Please file a GitHub issue for any question, bug reports or support requests.
- An encapsulated extendable
Subjectclass to factor out setups/teardowns code even futher.
- Hook into the node.js module system to simplify subjects even further. (i.e. automatic requires from a string.)
- Smoother integration with mocha. Right now
disinfect()requires you to set the
--globalsflags for mocha manually.