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

consider testing arg passed to done is an error object #475

Closed
nlf opened this issue Oct 28, 2015 · 4 comments
Closed

consider testing arg passed to done is an error object #475

nlf opened this issue Oct 28, 2015 · 4 comments
Assignees
Labels
bug
Milestone

Comments

@nlf
Copy link
Member

@nlf nlf commented Oct 28, 2015

currently as the documentation states

The test passes if done() is called once before the timeout, no exception thrown, and no arguments are passed to done()

I feel like this should be slightly more restrictive and also require that an argument passed to done() be an instance of Error.

As it is currently, if you pass a non-Error object to done, the reporter prints nothing. For example:

var lab = exports.lab = require('lab').script();

lab.test('shows garbage', function (done) {

  done('this isn\'t an error');
});

displays the following:

error

which is completely unhelpful. we should either print whatever was passed, or only error if the argument is an error object.

@devinivy

This comment has been minimized.

Copy link
Member

@devinivy devinivy commented Oct 28, 2015

Perhaps it could error if the argument is not an error object in a way that insists that an error object be passed.

@AdriVanHoudt

This comment has been minimized.

Copy link
Contributor

@AdriVanHoudt AdriVanHoudt commented Oct 28, 2015

To not suddenly let builds pass that use this I would like @devinivy said, error with a message to use an error and maybe also print what was passed

@geek geek added the feature label Nov 29, 2015
@geek

This comment has been minimized.

Copy link
Member

@geek geek commented Nov 29, 2015

@AdriVanHoudt and @devinivy sounds like a good plan to me

@geek geek added bug and removed feature labels Mar 2, 2016
@geek

This comment has been minimized.

Copy link
Member

@geek geek commented Mar 2, 2016

Fixed by 35cf424

@geek geek closed this Mar 2, 2016
@geek geek added this to the 7.1.0 milestone Mar 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.