Skip to content
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

Chai and ES6 polyfills #502

Closed
olivr70 opened this issue Jul 26, 2015 · 1 comment
Closed

Chai and ES6 polyfills #502

olivr70 opened this issue Jul 26, 2015 · 1 comment
Labels

Comments

@olivr70
Copy link

olivr70 commented Jul 26, 2015

Hello,

what are the guidelines in Chai regarding the runtime environment ? And more specifically for using some ES6 features :

  • use ES5 only, include code for missing features and use that code exclusively (never the ES6 version which may available in the environment)
    • This to be sure to run exactly the same code on all runtimes
  • use ES5 only, and include polyfilling code directly in the implementation.
    • This may lead to a less efficient code (environment adjustment is made in every call)
  • target ES5, and polyfill localy in chai.js
  • target ES5, and centralize all polyfills in a single util file
    • this could help remove polyfills later, or replace them by a third party polyfill component

I am asking because I need Number.isNaN() which is ES6 and has been natively available for a long time in Chrome (from v19) and Firefox (from v16).

I think this is may also be an interesting discussion for integration of ES6 specific features in chai (like isSymbol, String.isNormalized, Number.isFinite,closeTo using Number.EPSILON, testing typed arrays, iterators, computed property names...)

sorry if this has been discussed before, but I could not find any info in the site, the google group or the GitHub issues.

@keithamus
Copy link
Member

Thanks for the issue @olivr70, it's a good question.

We don't really have an official stance, but in general we'll support ES6 features where we can. There's enough evidence mounting that we're keeping with the curve and supporting ES6:

Any new patches/PRs are reviewed on a case-per-case basis, generally with the thought toward forward and backward compat - but obviously some things slip through (like #498).

Hopefully this answers your question well enough. I'll close this issue now as its a question - feel free to continue the discussion though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants