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

Qunit 2 Style #3509

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
3 participants
@misteroneill
Member

misteroneill commented Aug 8, 2016

Description

This updates tests to use QUnit 2.0-style assertions and test module lifecycle methods.

Specific Changes proposed

  • Move assertions from QUnit.ok() or ok() style to assert.ok() style.
  • Replace setup() with beforeEach() and teardown() with afterEach().

Requirements Checklist

  • Feature implemented / Bug fixed
  • Reviewed by Two Core Contributors
@BrandonOCasey

This comment has been minimized.

Show comment
Hide comment
@BrandonOCasey

BrandonOCasey Aug 8, 2016

Contributor

some of these commits are from your other PR #3508. Also we should probably update qunitjs to version 2 (maybe even karma-qunit too?)

Contributor

BrandonOCasey commented Aug 8, 2016

some of these commits are from your other PR #3508. Also we should probably update qunitjs to version 2 (maybe even karma-qunit too?)

@@ -24,23 +24,23 @@ const cleanup = (item) => {
};
if (Html5.supportsNativeTextTracks()) {
QUnit.test('trackToJson_ produces correct representation for native track object', function(a) {
QUnit.test('trackToJson_ produces correct representation for native track object', function(assert) {

This comment has been minimized.

@BrandonOCasey

BrandonOCasey Aug 8, 2016

Contributor

nice it actually changed these from a to assert 👍

@BrandonOCasey

BrandonOCasey Aug 8, 2016

Contributor

nice it actually changed these from a to assert 👍

This comment has been minimized.

This comment has been minimized.

@misteroneill

misteroneill Aug 9, 2016

Member

No... I did. 😆

@misteroneill

misteroneill Aug 9, 2016

Member

No... I did. 😆

Show outdated Hide outdated test/unit/component.test.js
QUnit.strictEqual(Component.prototype.options_.example.childOne.foo, 'bar',
assert.strictEqual(Component.prototype.options_.example.childOne.foo, 'bar',

This comment has been minimized.

@gkatsev

gkatsev Aug 8, 2016

Member

looks like this line still has weird styling around the arguments to equal.

@gkatsev

gkatsev Aug 8, 2016

Member

looks like this line still has weird styling around the arguments to equal.

Show outdated Hide outdated test/unit/tracks/html-track-element-list.test.js
const htmlTrackElementList = new HTMLTrackElementList(genericHtmlTrackElements);
QUnit.equal(htmlTrackElementList.length,
assert.equal(htmlTrackElementList.length,
genericHtmlTrackElements.length,

This comment has been minimized.

@gkatsev

gkatsev Aug 8, 2016

Member

a bunch of code is now slightly misaligned.

@gkatsev

gkatsev Aug 8, 2016

Member

a bunch of code is now slightly misaligned.

This comment has been minimized.

@misteroneill

misteroneill Aug 9, 2016

Member

This is why I'm not a fan of that continuation style. 😛

@misteroneill

misteroneill Aug 9, 2016

Member

This is why I'm not a fan of that continuation style. 😛

@gkatsev gkatsev removed the needs: LGTM label Aug 8, 2016

@misteroneill

This comment has been minimized.

Show comment
Hide comment
@misteroneill

misteroneill Aug 9, 2016

Member

@BrandonOCasey Good call on updating QUnit maybe. Also, the extra commits are due to rebasing. Once that PR is merged, I'll rebase this one again.

Member

misteroneill commented Aug 9, 2016

@BrandonOCasey Good call on updating QUnit maybe. Also, the extra commits are due to rebasing. Once that PR is merged, I'll rebase this one again.

@BrandonOCasey

This comment has been minimized.

Show comment
Hide comment
@BrandonOCasey

BrandonOCasey Aug 11, 2016

Contributor

LGTM

Contributor

BrandonOCasey commented Aug 11, 2016

LGTM

@misteroneill misteroneill added confirmed and removed needs: LGTM labels Aug 11, 2016

@gkatsev gkatsev modified the milestone: 3.12 build-improvements Aug 11, 2016

@gkatsev gkatsev added the minor label Aug 11, 2016

@gkatsev

This comment has been minimized.

Show comment
Hide comment
@gkatsev

gkatsev Aug 11, 2016

Member

Oops, I forgot that karma-qunitjs is being updates here as well.

Member

gkatsev commented Aug 11, 2016

Oops, I forgot that karma-qunitjs is being updates here as well.

@gkatsev

This comment has been minimized.

Show comment
Hide comment
@gkatsev

gkatsev Aug 11, 2016

Member

Could you rebase against master?

Member

gkatsev commented Aug 11, 2016

Could you rebase against master?

misteroneill added some commits Aug 8, 2016

qunit-migrate run and fixes
The tool was imperfect and I had to do a lot of search/replace to fix
it. And it broke a few tests.

@gkatsev gkatsev closed this in 72c44da Aug 12, 2016

@misteroneill misteroneill deleted the misteroneill:qunit-2-style branch Aug 12, 2016

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