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

Possibility to extend epilogue message #1056

Closed
keis opened this issue Dec 4, 2013 · 2 comments
Closed

Possibility to extend epilogue message #1056

keis opened this issue Dec 4, 2013 · 2 comments

Comments

@keis
Copy link

keis commented Dec 4, 2013

I wanted to extend the default reporter to include any log messages sent through log4js for failing test cases. Capturing the data was easy enough with the various hooks available on the runner.

However, to get the output I wanted I ended up copying a big chunk of base.js into my file. It would be nice if there was a easy way to extra output for each failure from the reporter, possibly through a hook?

my hack for reference https://gist.github.com/keis/7786301
the bit I wanted to add to the output is pretty much only

    if (test.capturedLog) {
        msg += '\n  Captured log messages:\n';
        test.capturedLog.forEach(function (log) {
            msg += '  ' + log;
        });
    }

I might try to dig in and create a patch but wanted to know if this is a good idea at all before starting.

@travisjeffery
Copy link
Contributor

the runner emits a 'fail' event you should be able to use https://github.com/visionmedia/mocha/blob/master/lib/runner.js#L198

@keis
Copy link
Author

keis commented Dec 7, 2013

Used that hook already to capture the data I wanted. but the bundled reporters are not doing their output (besides the dot) in that phase. What I wanted is to output the log messages together with the summary of failed test cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants