-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Use test helpers from ember dev #4040
Conversation
Hmm, looks like although the I am investigating... |
awesome |
Alright, so The problem with the previous approach was that the The current, working approach patches the The question is now if we want to use the approach of a patched // ember-data/tests/helpers/qunit.js
import { module } from "ember-qunit";
export default function(description, options = {}) {
var originalBeforeEach = options.beforeEach || function() {};
var originalAfterEach = options.afterEach || function() {};
// ...
return module(...arguments);
} And use this module in all the tests (instead of // ember-data/tests/integration/le-test.js
import module from "../helpers/qunit";
import { test } from "ember-qunit";
module("le module");
test("le test", function() {
// ...
}); |
This change re-uses the test helpers from ember-dev to check for expected assertions and deprecations as well as to confirm that there is no pending run-loop at the end of a test.
Currently `this._hasModelFor` returns the specific model, though - as the name implies - a boolean should be returned. --- Context: this change is especially needed so the assertion helper from ember-dev works correctly: this helper uses the checkTest function in test-helper/utils.js https://git.io/vuZK3. If a class is passed to the assertion, like in `Ember.assert("should exists", MyEmberClass)`, it is treated as a function and invoked within `checkTest`. This throws an error since ember classes are not function which can be invoked.
Getting an async`hasMany` relationship triggers a run-loop, so this needs to be wrapped inside `Ember.run`.
I think it is ok to use the patched QUnit module version for now, as this is also the way it is done in |
Thanks @pangratz |
This PR replaces the currently used test helpers to check for correct assertions, deprecations etcetera with the ones from emberjs/ember-dev.
This addresses #2456
TODO
ember-dev
helper raises errorEmber.run
QUnit.module
or our ownmodule