-
-
Notifications
You must be signed in to change notification settings - Fork 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
🐛 Bug: Mocha loads incomplete Promise polyfill #4783
Comments
@straker is the first image from IE11? Showing "F12 Developer Tools" and "function Promise() { [native code] }? Anyway I haven't reproduced your issue, because it's IE11 ... So I don't know how to proceed:
|
see also #4446 |
Thanks for the information. Yes the first image is from IE11 when mocha is loaded on the page. I'm not sure why core-js adds Promise as Would it be possible import the core-js Promise polyfill in the mocha code where it's used and then use the non-global import? That might get around the global pollute. import Promise from 'core-js-pure/features/promise'; |
I don't know, but by fixing "global Promise" only, the root problem still persists. There are dozens of other pollyfills loaded by Mocha. There is this babel-polyfills package, which seems to offer an option I would need some help on this issue. Maybe you know somebody, who could struggle through this transpiling challenge. We also have some funds to spend. |
There's no longer any code specific to Promises in |
Prerequisites
faq
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend that you not install Mocha globally.Description
I recently upgrade Mocha from v7 to latest and noticed that Mocha loads its own Promise polyfill. Unfortunately the polyfill is incomplete and does not implement Promise.finally and causes our tests to fail in IE11 (sorry, we can't drop support yet). We try to load
es6-promise
if we detect thatPromise
isn't already defined onwindow
, but since Mocha loads first we detect thatPromise
exists and don't load our working polyfill.I verified that the Promise polyfill is loaded starting in v8.1.0 and above.
With
![image](https://user-images.githubusercontent.com/2433219/139948691-eb45e2d9-6dd9-4efc-95a5-26fbf342ab96.png)
mocha
on the pageWithout
![image](https://user-images.githubusercontent.com/2433219/139950720-e663e405-af55-4e1a-9bce-0552d7acbb8e.png)
mocha
on the pageThe text was updated successfully, but these errors were encountered: