tests.js seems to not get Promise polyfilled for IE11 target
Ember-CLI v3.5.0, latest ember-cli-babel v6.
function _asyncToGenerator(fn) {
return function () {
var gen = fn.apply(this, arguments);
return new Promise(function (resolve, reject) {
function step(key, arg) {
tests.js contains code like this, which obviously won't run on IE11. By adding Promise polyfill to tests/index.html all my tests pass. So rest of the application is correctly transpiled for IE11 target.
For now I did something like this in tests/index.html
<script type="text/javascript">
if (!window.Promise) {
window.Promise = Ember.RSVP.Promise;
}
</script>
What does your config/targets.js looks like?
Default:
'use strict';
const browsers = [
'last 1 Chrome versions',
'last 1 Firefox versions',
'last 1 Safari versions'
];
const isCI = !!process.env.CI;
const isProduction = process.env.EMBER_ENV === 'production';
if (isCI || isProduction) {
browsers.push('ie 11');
}
module.exports = {
browsers
};
And is this in development or production (or CI)?
CI=true ember serve and CI=true ember test both behave the same.
Are you using async/await?
Does an ember new foo type app have this issue? If not, what addon (or other changes) is needed to replicate?
Steps to reproduce:
ember new fooember generate acceptance-test foo(simple await visit() test)CI=true ember serve- Navigate to http://localhost:4200/tests with IE11 -
ReferenceError: Promise is not defined
Example from “ember new foo” - https://gist.github.com/raido/8b71ffc275c261b302ae638658b6bd9c
@rwjblue any updates on this?
Could reproduce this bug for a newly created addon using latest ember-cli (3.8.1):
ember addon my-addoncd my-addonember generate acceptance-test foo# creates a test usingasync/awaitCI=true ember serve- Open
http://localhost:4200/testsin IE 11.
You will see ReferenceError: Promise is not defined as reported already for applications some while ago. It's not only affecting Promise but that's only the first issue you will run into. Having used the work-a-round provided by @raido I got a Symbol is not defined error caused by the result of transpiling a for...of statement.
I've faced this one while working on ember-power-calendar. You could use that one as a real-world showcase for the bug.
for...of - this is fine to fail as you have to opt into Babel polyfill and for...of is not the default suggested for you anyway.
async await although in tests is default scenario and that should work with IE11.
For anyone else that comes across this, we're now running into this as well after upgrading from Ember 2.X to 3.X. We run tests on IE using Sauce prior to deployment. This fix worked for us until a proper fix can be put in place.
I've ran this into again but in a somewhat weird way.
I upgraded app from Ember 3.7.x -> 3.12 LTS. All works fine for IE11 tests etc. App itself is on [email protected]
Then if I upgrade one of the addons that uses still depends [email protected] to newer version where the addon also switches to Babel 7, it breaks.
I instantly get Promise is not defined errors. Although I have still other addons that still depend on [email protected].
Feels like racing condition or I just don't understand how and which Babel version is used. App itself is already latest Babel, isn't that used to transpile tests.js or there some weird interop bug with Babel 6 addons vs Babel 7?
Below are all the changes from yarn.lock that break it.

v1.0.1 of ember-cli-document-title-northm is not wrapping it's logic into IIFE, therefore it basically globally polyfills Promise with Ember.RSVP.Promise.
https://github.com/mike-north/ember-cli-document-title-northm/blob/v1.0.1/vendor/document-title/document-title.js#L3
That's why tests break with v1.0.3 which introduced IIFE around all that code.
Which means app(s) using this addon have been accidentally piggybacking on Promise = Ember.RSVP.Promise.