TheBrainFamily / wait-for-expect

Wait for expectation to be true, useful for integration and end to end testing. Integral part of react-testing-library.
MIT License
293 stars 31 forks source link

fix: Transpile Object.assign which is not available in IE 11 #24

Closed eps1lon closed 5 years ago

eps1lon commented 5 years ago

We're using @testing-library/dom which uses this package and like to run tests in IE11. Unfortunately Object.assign is not available in that environment.

Fortunately we can transpile it to be compatible with IE 11.

In later TypeScript versions (^3.1) waitForExpect.defaults = defaults would be accepted though I assumed this would be a more controversial change (bumping the TS version). See https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html#properties-declarations-on-functions. I'd be happy to work on bumping TS to 3.1 if you'd prefer that.

lgandecki commented 5 years ago

Hey @eps1lon , thanks for this. Let me think a bit. If you wanted to try to bump the TypeScript to 3.1 and assign the defaults directly to waitForExpect as you suggested, so we can compare the compiled code and emited type declarations that would be great. I feel this might be a better way, and if the end-result of the transpiled code looks basically the same then I think there is little risk.

Since @kentcdodds will have to update the dependency it in the testing-library as well, I'm tagging him in case he has an opinion.

eps1lon commented 5 years ago

@lgandecki I'll work on an alternate and see how this looks like.

lgandecki commented 5 years ago

:tada: This issue has been resolved in version 3.0.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: