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

Detecting describe(function (done) { ... }) #14

Closed
mik01aj opened this issue Sep 2, 2015 · 2 comments
Closed

Detecting describe(function (done) { ... }) #14

mik01aj opened this issue Sep 2, 2015 · 2 comments

Comments

@mik01aj
Copy link

mik01aj commented Sep 2, 2015

I originally reported an issue in Jasmine: jasmine/jasmine#896 but now I think it would be actually more appropiate here.

I spent half an hour debugging this.

describe('stuff', function (done) {
    it('works good', function () {
        myHttp.get(url).then(function (response) {
            expect(response.data.length).toBeGreaterThan(10000);
        }).then(done, fail);
    });
});

I got an error in some other unrelated test, with no stacktrace (because async), and had to fire up a debugger to understand what's happening. And it was just a simple mistake.

(In case you still didn't notice: I put done in describe instead of it.)

I believe this wouldn't be hard to do (as you already look at the arguments of the function given in it) and would save other programmers from mistakes like this.

@tlvince
Copy link
Owner

tlvince commented Sep 3, 2015

Good idea.

Do you know if there's any case when passing a argument to describe is valid? (I've not seen one myself). Otherwise, we could simply test on if (arguments.length) { return 'fail' }.

@mik01aj
Copy link
Author

mik01aj commented Sep 3, 2015

It is, afaik, always invalid.

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

Successfully merging a pull request may close this issue.

2 participants