Unify internal testing styles
See original GitHub issueCurrently 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:
- 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.
- 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
}
});
- 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:
- container (π @t-sauer) https://github.com/emberjs/ember.js/pull/15990
- ember-application (π @locks)
- ember-debug (π @locks) https://github.com/emberjs/ember.js/pull/15998
- ember-metal (π @thoov) https://github.com/emberjs/ember.js/pull/16034 https://github.com/emberjs/ember.js/pull/16036 https://github.com/emberjs/ember.js/pull/16051
- ember-routing (π @thoov) https://github.com/emberjs/ember.js/pull/16015 https://github.com/emberjs/ember.js/pull/16029 https://github.com/emberjs/ember.js/pull/16030 https://github.com/emberjs/ember.js/pull/16072 https://github.com/emberjs/ember.js/pull/16105 https://github.com/emberjs/ember.js/pull/16106
- ember-runtime (π @thoov)
- ember-template-compiler (π @karthiick) https://github.com/emberjs/ember.js/pull/16010
- ember-utils (π @locks) https://github.com/emberjs/ember.js/pull/15997
- internal-test-helpers (π @thoov) https://github.com/emberjs/ember.js/pull/16033
- ember-testing (π @cibernox) https://github.com/emberjs/ember.js/pull/16022
- ember (π @locks) #16019 #16449
Below is the test related cleanup that is needed:
Issue Analytics
- State:
- Created 6 years ago
- Comments:20 (20 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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