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 · 4 comments
Assignees
Labels
Milestone

Comments

@hueniverse
Copy link
Member

@hueniverse hueniverse commented Jul 13, 2015

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')();
});
@hueniverse hueniverse added the request label Jul 13, 2015
@AdriVanHoudt

This comment has been minimized.

Copy link
Contributor

@AdriVanHoudt AdriVanHoudt commented Jul 13, 2015

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

@hueniverse

This comment has been minimized.

Copy link
Member Author

@hueniverse hueniverse commented Jul 15, 2015

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

This comment has been minimized.

Copy link
Member

@Marsup 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

This comment has been minimized.

Copy link
Member Author

@hueniverse hueniverse commented Jul 15, 2015

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 self-assigned this May 24, 2016
@geek geek added this to the 10.7.0 milestone May 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.