pagarme-js icon indicating copy to clipboard operation
pagarme-js copied to clipboard

Unable to test with PhantomJS

Open lucasrcdias opened this issue 8 years ago • 5 comments

Description

We have a Ruby on Rails application with integration tests using Poltergeist (PhantomJS) but we have some incompatibility issues.

One of the issues is that PhantomJS does not support ES6 features like Object.assign, to fix that we added a polyfill and it works.

The point is the following error with Ramda.js:

TypeError: reduce: list must be array or iterable

I don't know if it is related to lack of ES6 support from PhantomJS and we are unable to find what cause the error but we found that is related to Ramda :(

My Setup

  • Operating System: Ubuntu 16.04
  • Project Version: 3.1.2
  • NodeJS: 6.11.2
  • PhantomJS: 2.1.1
  • [x] I have tested with the latest version
  • [ ] I can simulate the issue easily

Current Behavior

Crashes when tries to run Pagarme-js lib with PhantomJS

Expected Behavior

Run tests using PhantomJS and be able to identify any ES6 feature that is used by Pagarme-js but isn't supported by PhantomJS or IE11, for example. No problem if we add polyfills to the ES6 features.

lucasrcdias avatar Oct 19 '17 18:10 lucasrcdias

That's weird because in ramda's homepage (http://ramdajs.com/) they use PhantonJS to run tests

MarcoWorms avatar Oct 19 '17 18:10 MarcoWorms

could you isolate the issue in a separate repo so I can clone it and check it out?

MarcoWorms avatar Oct 19 '17 18:10 MarcoWorms

It's really weird this Ramda error. I'll try to create the repo!

lucasrcdias avatar Oct 19 '17 18:10 lucasrcdias

I tried to reproduce as much as I can from my current environment at this repo: https://github.com/lucasrcdias/pagarmejs-phantomjs

I just want to point that I had an error with startsWith from ES6 with this repo and I added the startsWith polyfill.

In the end the error is the same:

TypeError: reduce: list must be array or iterable

lucasrcdias avatar Oct 19 '17 20:10 lucasrcdias

I don't know if it helps but I searched for reduce in source files and it's used in:

validations/validate/card/brand.js validations/validate/card/cardNumber.js validations/validate/card/cnpjAndCpf.js -> I didn't validate cnpj or cpf.

I wanted to help but I'm not familiar with Ramda.js and functional programming :/

lucasrcdias avatar Oct 20 '17 13:10 lucasrcdias