Qunit 2 Style #3509

Closed
wants to merge 3 commits into
from

Projects

None yet

3 participants

@misteroneill
Member
misteroneill commented Aug 8, 2016 edited

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
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?)

@BrandonOCasey BrandonOCasey commented on the diff Aug 8, 2016
test/unit/tracks/text-track-list-converter.test.js
@@ -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) {
@BrandonOCasey
BrandonOCasey Aug 8, 2016 Contributor

nice it actually changed these from a to assert 👍

@misteroneill
misteroneill Aug 9, 2016 Member

No... I did. 😆

@gkatsev gkatsev commented on an outdated diff Aug 8, 2016
test/unit/component.test.js
- QUnit.strictEqual(Component.prototype.options_.example.childOne.foo, 'bar',
+ assert.strictEqual(Component.prototype.options_.example.childOne.foo, 'bar',
@gkatsev
gkatsev Aug 8, 2016 Member

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

@gkatsev gkatsev and 1 other commented on an outdated diff Aug 8, 2016
test/unit/tracks/html-track-element-list.test.js
const htmlTrackElementList = new HTMLTrackElementList(genericHtmlTrackElements);
- QUnit.equal(htmlTrackElementList.length,
+ assert.equal(htmlTrackElementList.length,
genericHtmlTrackElements.length,
@gkatsev
gkatsev Aug 8, 2016 Member

a bunch of code is now slightly misaligned.

@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
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.

@BrandonOCasey
Contributor

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
Member
gkatsev commented Aug 11, 2016

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

@gkatsev
Member
gkatsev commented Aug 11, 2016

Could you rebase against master?

misteroneill added some commits Aug 8, 2016
@misteroneill misteroneill 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.
d91d202
@misteroneill misteroneill Fix some continuation indentation 09fb5e4
@misteroneill misteroneill Upgrade QUnit and karma-qunit
6aa4ae1
@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