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

Add ability to attach notes to test results #402

Closed
hueniverse opened this issue Jul 13, 2015 · 5 comments · Fixed by #593
Closed

Add ability to attach notes to test results #402

hueniverse opened this issue Jul 13, 2015 · 5 comments · Fixed by #593
Assignees
Labels
feature New functionality or improvement
Milestone

Comments

@hueniverse
Copy link
Contributor

There are times when a test passes (or fails) but you want to draw attention to some other data about it. My specific need is to record performance numbers (my tests confirm performance is under n milliseconds but I also want to see the actual numbers).

In order to keep the interface and implementation simple, we can just piggyback the done argument:

it('runs faster than 500ms', function (done) {
    expect(elapsed).to.be.below(500);
    done.note('Took: ' + elapsed + 'ms');
    done();
});

If we make note() return done we can also chain:

it('runs faster than 500ms', function (done) {
    expect(elapsed).to.be.below(500);
    done.note('Took: ' + elapsed + 'ms')();
});
@AdriVanHoudt
Copy link
Contributor

note would practically be a console.log but only when verbose is on? Or do you also want to export this or something?

@hueniverse
Copy link
Contributor Author

It will console log but at the end of the console report, and with the titles of the tests which generated them, and in the JSON output for other reporters to potentially include.

@Marsup
Copy link
Contributor

Marsup commented Jul 15, 2015

I don't really care for that feature but I'm not sure it should be a simple string. It might as well be useful to call it multiple times for different information. But then the reporters should know how to deal with it. Ideas ?

@hueniverse
Copy link
Contributor Author

You can call it with anything you want. It is free form reference. If you call it multiple times it will just add them to an array. I would just console log them if you specify a command flag. Otherwise just add them to the JSON output.

@geek geek added feature New functionality or improvement and removed request labels May 24, 2016
@geek geek self-assigned this May 24, 2016
@geek geek added this to the 10.7.0 milestone May 24, 2016
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New functionality or improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants