Skip to content

Loading…

Deprecate expect argument from test() and asyncTest() #356

Open
jzaefferer opened this Issue · 5 comments

4 participants

@jzaefferer
jQuery Foundation member

Use expect(x) or assert.expect(x) instead.

@FagnerMartinsBrack

Why? I think it is much better detach that information from the regular test flow. If you use an expect(x) inside the callback it will be valid for the whole scope isn't it? Is this change going to allow multiple expect or anything like that?

@Krinkle
jQuery Foundation member
If you use an expect(x) inside the callback it will be valid for the whole scope isn't it?

Yes. The second argument to test() just calls expect( .. ) internally.

Is this change going to allow multiple expect or anything like that?

No.

@FagnerMartinsBrack

So what is the reason for the deprecation if it will be valid for the whole scope in a way or another?
In my point of view the argument works much better than calling expect(x) inside the callback but I want to know why this should be a bad practice.

@jzaefferer
jQuery Foundation member

Calling expect(x) makes the intention explicit.

@FagnerMartinsBrack FagnerMartinsBrack referenced this issue in carhartl/jquery-cookie
Merged

Remove expect from tests arguments #141

@jzaefferer jzaefferer added a commit that referenced this issue
@jzaefferer jzaefferer Tests: Stop using the expected argument in test() calls
First step to deprecating the expected argument. Will warn about bad usage
in 2.0.0 in fully remove in 2.1.0.

Ref #356
23a2a75
@jzaefferer
jQuery Foundation member

Updated our testsuite to stop using the expected argument. Updated API docs to remove the expected argument, along with a note about the deprecation. I've created #501 to actually remove the support for the argument. This ticket now has the 2.0.0 milestone, to add a warning when trying to use the argument.

@berkerpeksag berkerpeksag added a commit to berkerpeksag/qunit that referenced this issue
@berkerpeksag berkerpeksag Test: Deprecate the 'expected' argument of QUnit.test
Fixes #356
9fef7d3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.