import { Promise } from 'rsvp'; causes simple tests to fail
See original GitHub issueA simple component like this:
export default Component.extend({
actions: {
show() {
this.set('show', true);
}
}
})
<button onclick={{action 'show'}}>show</button>
{{if show 'showing'}}
…and a basic integration test will pass with the new v3 style tests.
However, when import { Promise } from 'rsvp';
is added the test will fail
See this example repo
import { Promise as EmberPromise } from rsvp
fixes it
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
RSVP.Promise - 3.5 - Ember API Documentation
Promises that are rejected have a rejection reason and are in the rejected state. A fulfillment value is never a thenable.
Read more >Using Ember (cli) how do I get an acceptance test to wait for a ...
var promise = Ember. Test. promise(function (resolve, reject) {...}); and not those where the promise is instantiated directly, i.e.
Read more >Should I still be using RSVP over vanilla promises? : r/emberjs
We import RSVP.Promise as EmberPromise, then have a lint rule disallowing native Promise. Too many flaky tests caused by forgetting to use ...
Read more >Using promises - JavaScript - MDN Web Docs
A Promise is an object representing the eventual completion or failure of an asynchronous operation. Since most people are consumers of ...
Read more >Testing Async in Ember.js — Part One | by Chris Masters
So that now the loading and error behaviour is encapsulated in a promise. Integration tests. In the case of an integration test you...
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 FreeTop 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
Top GitHub Comments
I’m going to close this issue, but hopefully the breadcrumbs above help folks that might stumble on the same things.
There are three possible fixes here (all of which should probably be done):
Upgrade to ember-cli-babel@6.10.0, which includes https://github.com/babel/ember-cli-babel/pull/197 so that the
import { Promise } from 'rsvp';
does not forceregenerator-runtime
to useEmber.RSVP.Promise
.Update to use the newer DOM helpers introduced in emberjs/rfcs#268, and released in
ember-cli-qunit@4.2.0
(just today). These helpers are async and properly run-wrapped (they also use native DOM events so are more correct than the simulated jQuery events that are being used in the test ATM). The only caveat is that these helpers do not allow thejQuery
style selectors (button:contains('Showing')
) that are being used here.