Skip to content
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.

use of JavaScript's let will fail silently #823

Open
pawel2105 opened this issue Nov 1, 2016 · 3 comments
Open

use of JavaScript's let will fail silently #823

pawel2105 opened this issue Nov 1, 2016 · 3 comments

Comments

@pawel2105
Copy link

I've stumbled across a bug where JavaScript enabled specs fail silently due to the use of JavaScript's let assignment operator. Using let instead of var will break whatever other code resides in the same <script> tag as the let keyword.

Capybara.javascript_driver = :poltergeist

Capybara.register_driver :poltergeist do |app|
  options = { js_errors: true }
  Capybara::Poltergeist::Driver.new(app, options)
end

This is true despite having js_errors set to be true.

To reproduce run a spec for a page that has:

<script type="text/javascript">
  var message = 'works fine';
</script>

versus one that has:

<script type="text/javascript">
  let message = 'fails silently';
</script>
@twalpole
Copy link
Contributor

twalpole commented Nov 1, 2016

This is a limitation of PhantomJS. PhantomJS doesn't support ES6, and let is an ES6 feature

@twalpole
Copy link
Contributor

twalpole commented Nov 1, 2016

It appears that PhantomJS only reports runtime errors, not parse time errors. Not sure there's anything we can do about that if PhantomJS doesn't tell us.

@diegoesp
Copy link

+1

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

No branches or pull requests

3 participants