-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Asserting error thrown no longer works as of 2.11 #15013
Comments
I am seeing identical errors with should.js and expect style assertions, also using mocha. Though, I only see this when bumping from 2.11.2 to 2.11.3.
|
Is this something that can be replicated using ember-twiddle? |
@pixelhandler i'm struggling getting an ember-mocha twiddle set up, any tips / examples? |
I tried to reproduce it without any success. Maybe something related to the Ember versions in the Twiddle? https://ember-twiddle.com/8932ace19517f83ef12693068381b6a3?openFiles=twiddle.json%2C |
As one of the Stackoverflow comment says they could not reproduced it in twiddle. |
I've reproduced this in a Twiddle. The key to reproduction is to run any acceptance test before running the test that asserts the thrown error. Running the acceptance test populates |
According to this ticket (emberjs/ember.js#15013) and this ticket (emberjs/ember-mocha#141) ember 2.11 broke testing exceptions.
* Upgrade ember-cli 2.11.0 * Upgrade to ember-cli 2.12.1 * Update mocha tests * ember#release seems to be borked. * Skip test related to testing thrown errors According to this ticket (emberjs/ember.js#15013) and this ticket (emberjs/ember-mocha#141) ember 2.11 broke testing exceptions.
Here's a work-around for QUnit: import Ember from 'ember';
import QUnit from 'qunit';
import { QUnitAdapter } from 'ember-qunit';
// Work-around for https://github.com/emberjs/ember.js/issues/15013
const originalAssertThrows = QUnit.assert.throws;
const rethrowAdapter = QUnitAdapter.extend({
exception(error) {
throw error;
},
}).create();
QUnit.assert.throws = () => {
const originalAdapter = Ember.Test.adapter;
Ember.Test.adapter = rethrowAdapter;
originalAssertThrows.apply(this, arguments);
Ember.Test.adapter = originalAdapter;
}; |
Asserting error thrown no longer works as of ember 2.11 see [emberjs/ember.js#15013](emberjs/ember.js#15013) and [emberjs/ember-mocha#141](emberjs/ember-mocha#141)
Asserting error thrown no longer works as of ember 2.11 see [emberjs/ember.js#15013](emberjs/ember.js#15013) and [emberjs/ember-mocha#141](emberjs/ember-mocha#141)
Asserting error thrown no longer works as of ember 2.11 see (emberjs/ember.js#15013) and (emberjs/ember-mocha#141)
Asserting error thrown no longer works as of ember 2.11 see (emberjs/ember.js#15013) and (emberjs/ember-mocha#141)
I've narrowed down the problem to the following change: a90fa06#diff-33ff1529a427727ffe2425f145375540L24. Reverting the change back to theory as why this happensChai's underlying |
Note that I cannot update to ember 2.12 just yet until there is a resolution for emberjs/ember.js#15013
Just came across this same issue while attempting to update an addon from ember/cli |
For now, I am skipping the three tests that assert that errors are thrown, until I can find a resolution for emberjs/ember.js#15013 Additionally, I fixed the _lookupFactory deprecation in favor of factoryFor Also, removed a few jshint pragmas
I'm currently working on our ember-link-with-follower update and running across this issue in our tests: echobind/ember-links-with-follower#191. We're using ember-cli-mocha. |
Currently you cannot test assertions since Ember 2.11 due to this bug: emberjs/ember.js#15013
@ykaragol I'm curious if this is still an issue in 2.16.x ? |
@pixelhandler I didn't test it. I'd just use the workaround shown in the StackOverflow Question. |
The ember-qunit-assert-helpers addon was specifically created to handle this scenario... |
The following test, no longer run after we start to use 2.11.1.
I saw mocha users had faced with nearly the same problems: emberjs/ember-mocha#141
SO Question: http://stackoverflow.com/questions/42781085/ember-render-hbs-swallowing-thrown-error
Slack Archive: https://embercommunity.slack.com/archives/-testing/p1489479464001332
Repro
https://ember-twiddle.com/47c4cfbb571ac3fa83ab912f605ebc6a?fileTreeShown=false&openFiles=tests.integration.components.i-throw-test.js%2C
The text was updated successfully, but these errors were encountered: