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

Use of Array.prototype.includes breaks unit tests in browsers that do not support this. #608

Closed
honeroku opened this issue May 15, 2018 · 6 comments

Comments

@honeroku
Copy link
Contributor

Version

1.0.0-beta.16

Reproduction link

https://codesandbox.io/s/7ykvrxrw0

Steps to reproduce

  1. Download codesandbox codes.
  2. Run tests on IE11 with karma.

What is expected?

Tests should pass or fail, but not be terminated.

What is actually happening?

Test is terminated due to "TypeError: Object doesn't support property or method 'includes"


Same as #499 which reports use of 'Array.prototype.find'.

The specific line is:
https://github.com/vuejs/vue-test-utils/blob/v1.0.0-beta.16/packages/test-utils/src/wrapper.js#L519

Array.prototype.includes supported browsers:
https://caniuse.com/#search=Array.prototype.includes

@eddyerburgh
Copy link
Member

Thanks for the issue.

Would you like to make a PR replacing includes with an alternative?

@honeroku
Copy link
Contributor Author

@eddyerburgh Sure I will.

I found findIndex too that is not supported in IE..

@eddyerburgh
Copy link
Member

We can't run tests against ie11 on CircleCI.

One solution would be to use eslint-compat to check for methods that aren't supported in ie11.

@38elements
Copy link
Contributor

I think it resolve this issue to use babel instead of buble.
It uses Runtime transform.
It sets the targets is ie == 11.

@eddyerburgh
Copy link
Member

The decision to use buble was because it generates more readable output.

We could revisit and compare the output to seen if babel output is readable enough.

@eddyerburgh
Copy link
Member

This issue is fixed and will be in the next release.

I think we should keep buble for now, although we can reinvestigate when we move the repo to typescript.

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

No branches or pull requests

3 participants