Skip to content

All: Remove deprecated features#976

Closed
leobalter wants to merge 9 commits intoqunitjs:masterfrom
leobalter:2.0-start
Closed

All: Remove deprecated features#976
leobalter wants to merge 9 commits intoqunitjs:masterfrom
leobalter:2.0-start

Conversation

@leobalter
Copy link
Copy Markdown
Member

  • globals
  • assertions on QUnit namespace
  • QUnit.stop
  • QUnit.init
  • setup/teardown
  • asyncTest
  • test with expected and async parameters
  • old style for logging callbacks
  • duration property on testDone details

This is the first batch. It can be improved and QUnit.reset is not addressed here yet.

@leobalter leobalter added this to the v2.0 milestone Mar 25, 2016
src/core.js Outdated
asyncTest: asyncTest,
asyncTest: function() {
throw new Error(
"asyntTest is now removed from QUnit 2.0, check out our upgrade guide at " +
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/asyntTest/asyncTest/. And as an aside, I notice that only some of the removals come with throws... when will we fully complete the process and drop even these?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've set throws only for removed methods as asyncTest, init, stop, and the previously exposed globals.

I skipped throwing for features as setup/teardown, test signature, etc.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should mention QUnit.test() with assert.async() as replacement:

"asyncTest is removed in QUnit 2.0, use QUnit.test() with assert.async() instead. Details in our upgrade guide at " +

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then apply that to any other replacements as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leobalter leobalter force-pushed the 2.0-start branch 2 times, most recently from f660082 to 74102e4 Compare April 12, 2016 17:50
@leobalter
Copy link
Copy Markdown
Member Author

@gibson042 is there anything I should change?

@jzaefferer would you take a look on this one?

src/export.js Outdated
}
( function() {
var i;
var assertions = Assert.prototype;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use a single var

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TL;DR: yes.

that's a mess I'm making after changes that happened on our style guide. It was a suggesting a single var and then it suggested 1 var per line, stacking non initialized variables on the same line. Now there's nothing and I'm confused.

At least on of the examples the style guide is using a single var, so I'll apply the change you suggested.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I personally prefer 1 var per line, but everywhere else in QUnit we use a single var.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done! I fixed this on a rebased commit, my bad I amended to a fixup commit.

@trentmwillis
Copy link
Copy Markdown
Member

Overall 👍. Still need to get that typo mentioned here.

- globals
- assertions on QUnit namespace
- QUnit.stop
- QUnit.init
- setup/teardown
- asyncTest
- test with expected and async parameters
- old style for logging callbacks
- duration property on testDone details
@leobalter
Copy link
Copy Markdown
Member Author

I'll wait for @jzaefferer to take a look on this, as he mentioned he will do it tomorrow, or today on his timezone. :)

After it's merged I'll proceed merging the other done PRs with breaking changes.

I'll probably try a pre-release so we can all test it on different suites.

// DEPRECATED: handles setup/teardown functions,
// beforeEach and afterEach should be used instead
if ( testEnvironment && testEnvironment.setup ) {
testEnvironment.beforeEach = testEnvironment.setup;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should throw an error as well, otherwise the setup and teardown properties are simply ignored, breaking tests in unexpected ways.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't throw, otherwise removing it on 2.1 would be a breaking change.

We may log a warning, console.warn is available on the set of supported browsers for 2.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright

src/export.js Outdated
function applyDeprecated( name ) {
return function() {
throw new Error(
"`" + name + "` is removed in QUnit 2.0, you should now use the " +
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's drop the backticks; this isn't a great error message:

The global ok is removed…

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ef9c175 what do you think? Also the global message is "The global ok is removed..."

@leobalter
Copy link
Copy Markdown
Member Author

@jquery/qunit I believe I addressed all the reviews so far, how is it now?

src/test.js Outdated
config.current.semaphore -= 1;

// If semaphore is non-numeric, throw error
if ( isNaN( config.current.semaphore ) ) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably unnecessary now that the function is internal.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

semaphore is still exposed. Can we remove it securely? I'll check this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so, I can do this (es5 + ie9+ support ftw):

Object.defineProperty(config.current, "semaphore", { set: function() { throw ... } ));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

semaphore is not documented, so anyone using it directly is already coloring outside the lines.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

21c254a I tried this refactoring, it's working and it avoids using the config.current using test directly whenever is possible. I'll do a inline comment to show the point I'm not satisfied

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot do any inline comments because it's not close from a change I did:

You can see here I have this resumeProcessing() that can't be called with the current test where done was set in. Doing it breaks the current suite.

We can investigate this in another issue, but for me it looks we are leaking the async functionality somehow and our current tests are returning false positives.

@gibson042
Copy link
Copy Markdown
Member

There seems to be a little cruft from arguments handling, but I'm satisfied overall. LGTM.

Use test.semaphore directly whenever is possible instead of
config.current.semaphore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants