question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unify internal testing styles

See original GitHub issue

Currently there are two different styles that tests are written. An older style which uses a QUnit global to define the module and tests via QUnit.module() and QUnit.test(). The old style also uses globals for the assertion such as ok, equal, etc. A newer style which does not use QUnit globals is partially rolled out in some of the packages. This issue tracks the work needed to move all tests over to the newer style and the related work surrounding it.

A breakdown of how to complete the conversion:

  1. QUnit.module becomes moduleFor
// Old Style:
QUnit.module('<MODULE_NAME>');

// New Style:
import { moduleFor, AbstractTestCase } from 'internal-test-helpers';

moduleFor('<MODULE_NAME>', class extends AbstractTestCase {
  //...
});

Note: There are a few test case classes already so check here for other options.

  1. QUnit.test becomes a property on the test case class
// Old Style:
QUnit.test('<TEST_NAME>', function() {
  // test case here
});

// New Style:
moduleFor('<MODULE_NAME>', class extends TestCase {
  ['@test <TEST_NAME>'](assert) {
    // test case here
  }
});
  1. Assertions should be references off of the callback assert argument
// Bad:
QUnit.test('<TEST_NAME>', function() {
  equal(1, 1);
});

// Bad:
moduleFor('<MODULE_NAME>', class extends TestCase {
  ['@test <TEST_NAME>']() {
    this.assert.equal(1, 1);
  }
});

// Good:
moduleFor('<MODULE_NAME>', class extends TestCase {
  ['@test <TEST_NAME>'](assert) {
    assert.equal(1,1)
  }
});

Below are the packages that need to be converted:

Below is the test related cleanup that is needed:

  • Move off of QUnit global (πŸ”’ @thoov)
  • upgrade to QUnit 2 #16073
  • remove testBoth & testWithDefault (πŸ”’ @thoov) #16450

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:20 (20 by maintainers)

github_iconTop GitHub Comments

1reaction
cibernoxcommented, Dec 22, 2017

I can take ember-testing

0reactions
pixelhandlercommented, Oct 19, 2018

@Turbo87 @cibernox @karthiicksiva @locks @mikerhyssmith @rwjblue @t-sauer @thoov is this still an issue, perhaps we should close, what do you think?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Frontend testing standards and style guidelines - GitLab Docs
There are two types of test suites encountered while developing frontend code at GitLab. We use Jest for JavaScript unit and integration testing,...
Read more >
biblatex-unified.pdf - CTAN
The biblatex-unified style consists of two files: ... Testing consists of rendering unified-test.tex (and unified-test.bib) into.
Read more >
UNIFY User Guide - Turning Technologies
Tests. 16. High Stakes Admin Permissions. 16. Setting Menu Security ... UNIFY FUNCTIONAL ROLES ... Select from a variety of special font styles....
Read more >
Loop & Merge - Qualtrics
See Testing & Editing an Active Survey for more information. In the Survey tab, click the block you want to repeat. Block clicked;...
Read more >
New features in Android Studio Preview
The emulator screen will resize so you can easily test your app across a range ... versions in the production, open, closed and/or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found