Skip to content

Conversation

@gaearon
Copy link
Collaborator

@gaearon gaearon commented Dec 1, 2017

This adds test coverage for these lines:

var hasBadMapPolyfill = false;
try {
var nonExtensibleObject = Object.preventExtensions({});
/* eslint-disable no-new */
new Map([[nonExtensibleObject, null]]);
new Set([nonExtensibleObject]);
/* eslint-enable no-new */
} catch (e) {
// TODO: Consider warning about bad polyfills
hasBadMapPolyfill = true;
}

I only did this for Map because it's a bit hacky, and I figured this would be enough to find regressions.

It fails the bundle tests because apparently Rollup strips the new calls out (which is how we discovered the problem with this check). So I added a workaround for that, and a TODO to report this to Rollup.

@gaearon gaearon changed the title Add a test for bad Map polyfill Add a test for bad Map polyfill, and work around Rollup bug Dec 1, 2017
@gaearon gaearon requested review from acdlite and bvaughn December 1, 2017 18:35
@gaearon
Copy link
Collaborator Author

gaearon commented Dec 1, 2017

cc @lukastaegert, wondering if it's a known issue?

Copy link
Collaborator

@acdlite acdlite left a comment

Choose a reason for hiding this comment

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

Cool test!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants