Skip to content

🐛 Bug: Mocha loads incomplete Promise polyfill #4783

Closed
@straker

Description

@straker

Prerequisites

  • Checked that your issue hasn't already been filed by cross-referencing issues with the faq label
  • Checked next-gen ES issues and syntax problems by using the same environment and/or transpiler configuration without Mocha to ensure it isn't just a feature that actually isn't supported in the environment in question or a bug in your code.
  • 'Smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, your usage of Mocha, or Mocha itself
  • Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with: node node_modules/.bin/mocha --version(Local) and mocha --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 that Promise isn't already defined on window, but since Mocha loads first we detect that Promise exists and don't load our working polyfill.

I verified that the Promise polyfill is loaded starting in v8.1.0 and above.

With mocha on the page
image

Without mocha on the page
image

Metadata

Metadata

Labels

area: browserbrowser-specificsemver-majorimplementation requires increase of "major" version number; "breaking changes"status: accepting prsMocha can use your help with this one!type: buga defect, confirmed by a maintainer

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions