Skip to content

Test: Deprecate the 'expected' argument of QUnit.test#885

Closed
berkerpeksag wants to merge 2 commits into
qunitjs:masterfrom
berkerpeksag:issue-356-expected
Closed

Test: Deprecate the 'expected' argument of QUnit.test#885
berkerpeksag wants to merge 2 commits into
qunitjs:masterfrom
berkerpeksag:issue-356-expected

Conversation

@berkerpeksag

Copy link
Copy Markdown

Fixes #356

I left asyncTest untouched because of #656.

Comment thread src/test.js Outdated

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 a great start for #861, but we need to make a better structure out of it.

QUnit 1.x.x still supports browsers and other environments without the console object, or not even the console.warn.

I believe we should make a better structure first before triggering the warnings, like prefixing all the deprecation messages with an all caps DEPRECATED, also the HTML Reporter might get this info from the logs and show it on the reporter messages as well.

Also, I would like to have an internal method for the warning messages instead of checking for console.warn everywhere.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the review.

like prefixing all the deprecation messages with an all caps DEPRECATED

Done.

also the HTML Reporter might get this info from the logs and show it on the reporter messages as well.

I'm not sure my design is the best one, but I came up with the following:

  • Add a QUnit.deprecationWarnings list
  • In deprecateWarns helper (added in core/utilities.js), use console.warn if available and add warnings to QUnit.deprecationWarnings
  • In HTML reporter, use QUnit.deprecationWarnings to show warning list and total count of warnings(e.g. Tests completed in 1092 milliseconds. 511 assertions of 513 passed, 2 failed.1 warnings)

Does that sounds good to you?

Also, I would like to have an internal method for the warning messages instead of checking for console.warn everywhere.

Done. Added in core/utilities.js.

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.

Does that sounds good to you?

It sounds great, but I would use a QUnit.warnings instead of deprecationWarnings, with that we can reuse it to any other warning type, even if it's not a deprecated one.

Done. Added in core/utilities.js.

Did you pushed the commit with it? I would love to see it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Did you pushed the commit with it? I would love to see it.

No, I was waiting for your feedback for my other comments. I will update the PR in a day or two.

Thanks!

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 warnings API will solve #881 partially, and it'll be crucial for the 2.0 release 👍

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done.

@leobalter

Copy link
Copy Markdown
Member

Hey @berkerpeksag, I'm looking forward to see this when it's ready.

@berkerpeksag

Copy link
Copy Markdown
Author

My apologies, I have a job interview this week. I will work on the PR over the weekend.

@leobalter

Copy link
Copy Markdown
Member

No problem. Thanks for the update and the best of luck on the interview.

@berkerpeksag

Copy link
Copy Markdown
Author

Sorry about the delay.

I'm not so sure about storing all warnings in a global QUnit.warnings array. Perhaps it should be stored as config.moduleStats.warnings or something similar?

@leobalter

Copy link
Copy Markdown
Member

we got a conflict with #918, I need to figure out how to solve it.

@leobalter

Copy link
Copy Markdown
Member

@berkerpeksag I'm sorry for the delay and mess on this process. The warning api is not going to land for this deprecation. Thanks for the support.

@leobalter leobalter closed this Apr 18, 2016
@berkerpeksag berkerpeksag deleted the issue-356-expected branch April 18, 2016 16:42
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.

3 participants