Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attach sub-reporters to the multiple reporter #397

Merged
merged 1 commit into from Jul 14, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -12,7 +12,8 @@ var internals = {};

exports = module.exports = internals.Reporter = function (options) {

internals.reporters = [];
var self = this;
self._reporters = [];

options.reporter.forEach(function (reporter, index) {

@@ -27,45 +28,45 @@ exports = module.exports = internals.Reporter = function (options) {

var reporterKey = reporterOptions.reporter;
var reporterIndex = 2;
while (internals.reporters.hasOwnProperty(reporterKey)) {
while (self._reporters.hasOwnProperty(reporterKey)) {
reporterKey = reporterOptions.reporter + reporterIndex;
reporterIndex++;
}

internals.reporters[reporterKey] = Reporters.generate(reporterOptions);
self._reporters[reporterKey] = Reporters.generate(reporterOptions);
});
this.settings = options;
};


internals.Reporter.prototype.start = function (notebook) {

for (var key in internals.reporters) {
internals.reporters[key].start(notebook);
for (var key in this._reporters) {
this._reporters[key].start(notebook);
}
};


internals.Reporter.prototype.test = function (test) {

for (var key in internals.reporters) {
internals.reporters[key].test(test);
for (var key in this._reporters) {
this._reporters[key].test(test);
}
};


internals.Reporter.prototype.end = function (notebook) {

for (var key in internals.reporters) {
internals.reporters[key].end(notebook);
for (var key in this._reporters) {
this._reporters[key].end(notebook);
}
};


internals.Reporter.prototype.report = function (text) {

for (var key in internals.reporters) {
internals.reporters[key].report(text);
for (var key in this._reporters) {
this._reporters[key].report(text);
}
};

@@ -74,8 +75,8 @@ internals.Reporter.prototype.finalize = function (notebook, callback) {

this._results = { err: false, code: [], output: [], count: 0 };

for (var key in internals.reporters) {
internals.reporters[key].finalize(notebook, this.finalizeSingle(key, callback));
for (var key in this._reporters) {
this._reporters[key].finalize(notebook, this.finalizeSingle(key, callback));
}
};

@@ -91,7 +92,7 @@ internals.Reporter.prototype.finalizeSingle = function (key, callback) {
self._results.code[key] = code;
self._results.output[key] = output;

if (self._results.count === Object.keys(internals.reporters).length) {
if (self._results.count === Object.keys(self._reporters).length) {
callback(self._results.err, self._results.code, self._results.output);
}
};
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.