mocha-apiary-reporter
Version:
Generate API documentation using Apiary's Blueprint style, then plug it right into apiary.io to get beautiful docs!
22 lines (17 loc) • 469 B
JavaScript
var _ = require('lodash');
var module = require('module');
var _load = module._load;
var moduleNames = {};
exports.module = function(name, fn) {
moduleNames[name] = fn;
};
module._load = function(path) {
var mdl = _load.apply(this, arguments);
var hasPatch = moduleNames.hasOwnProperty(path)
if (hasPatch && !mdl.__reporterPatched) {
console.log('Instrumenting ', path)
moduleNames[path](mdl);
mdl.__reporterPatched = true;
}
return mdl;
};