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

Dep updates, update polyfill handling #2536

Closed
wants to merge 6 commits into from
Closed

Dep updates, update polyfill handling #2536

wants to merge 6 commits into from

Conversation

avindra
Copy link
Contributor

@avindra avindra commented Nov 9, 2019

Continuation of PR #2410. That PR was accepted, and reverted in #2479 only because there was an IE test that broke on master branch. The IE builds, for some reason, don't run on PR builds, so nobody caught the issue during PR review.

Added a Cloudflare CDN polyfill for promise, which should fix the IE build breaking in continuous integration in master builds.

@avindra
Copy link
Contributor Author

avindra commented Nov 10, 2019

@felipewmartins The PR build doesn't run against IE https://travis-ci.org/axios/axios/jobs/609776027

I think this is because there is a secret for SauceLabs that only runs on master builds. The master builds have real IE tests.

@avindra
Copy link
Contributor Author

avindra commented Feb 7, 2020

Rebased and included more dep updates since I first opened the PR (bundlesize, coveralls, karma-core, mocha, sinon, etc..)

@avindra
Copy link
Contributor Author

avindra commented Feb 7, 2020

@chinesedfan @yasuf maybe one of you can review? 🙏

@avindra avindra changed the title Dep updates and ie polyfill Dep updates, update polyfill handling Feb 7, 2020
lib/utils.js Outdated
function isArray(val) {
return toString.call(val) === '[object Array]';
}
var _toString = Object.prototype.toString;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid PR. The only tiny thing I can mention is keeping the old name toString.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I did this to remove the /* global directive. I've reverted to the old name per your suggestion 👍

 * handles webpack 1 -> 4 migration
assume `Promise` is available, or polyfilled by
the consumer
String.protoype.trim has good coverage (including IE9)

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim

Also, the http adapter already uses the native method.
this approach avoids having to include
a fully baked promise solution.

note: the tests already rely on
appspot.com to be up and running
@avindra
Copy link
Contributor Author

avindra commented Feb 24, 2020

@chinesedfan updated again, and reverted toString to the previous name.

I was also able to remove this directive:

 /*global toString:true*/

It seems to be no longer needed with the new build baseline

<script>
if (typeof Promise !== "function")
document.write('<script src="//cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.1/es6-promise.min.js"><\/script>');
</script>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a Cloudflare CDN polyfill for promise, which should fix the IE build breaking in continuous integration in master builds.

I recalled a question here. What's the difference between those two promises? And did you really test by IE?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chinesedfan sorry for the late reply. The Promise here is only really needed for running the unit tests in IE.

In my opinion, the unit tests can/should be moved to a brower-less testing approach, which would allow for the removal of any Promise polyfill and faster testing, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chinesedfan I had some trouble getting the IE VM from Microsoft up and running. Maybe Github actions can help with the problem here. They explicitly support the Windows containers:

https://github.com/features/actions

@avindra
Copy link
Contributor Author

avindra commented Aug 4, 2020

Not interested in this anymore, someone else can feel free to continue if you're interested.

@avindra avindra closed this Aug 4, 2020
@avindra avindra mentioned this pull request Nov 12, 2020
@@ -226,7 +204,7 @@ function forEach(obj, fn) {
obj = [obj];
}

if (isArray(obj)) {
if (Array.isArray(obj)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proof that Array.isArray is well supported and possibly more reliable since it doesn't depend on a string representation check:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray#Browser_compatibility

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

Successfully merging this pull request may close these issues.

None yet

4 participants