Skip to content

PhantomJS can't test all of our ES6 code?

In !7731 (merged), I attempted to use the syntax:

      for (let variable of $variables) {

When I attempted to test this code with rspec/PhantomJS, I got the error message:

Capybara::Poltergeist::JavascriptError:
       One or more errors were raised in the Javascript code on the page. If you don't care about these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (see documentation for details).
     
       ReferenceError: Can't find variable: Symbol
       ReferenceError: Can't find variable: Symbol
           at http://127.0.0.1:59628/assets/application.js:49375 in toggleRevealState
           at :0 in toggleRevealState
           at http://127.0.0.1:59628/assets/application.js:4733 in dispatch
           at http://127.0.0.1:59628/assets/application.js:4545 in handle
           at :0 in sendEvent
           at phantomjs://code/web_page.js:55
           at phantomjs://code/web_page.js:501 in mouseEvent
           at phantomjs://code/node.js:67 in mouseEvent
           at phantomjs://code/browser.js:372 in mouse_event
           at phantomjs://code/browser.js:393 in click
           at phantomjs://code/browser.js:85 in runCommand
           at phantomjs://code/cmd.js:26 in run
           at phantomjs://code/main.js:22 in runCommand
           at phantomjs://code/connection.js:16 in commandReceived
           at phantomjs://code/connection.js:1
     # ./spec/features/variables_spec.rb:42:in `block (2 levels) in <top (required)>'

The converted code appears to be:

            for (var _iterator = _this.$buttons[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {

This problem seems related to https://github.com/angular/angular/issues/8064.

I see in spec_helper we include bind-poly, but that's it. Do we need a ES6 polyfill? How did this work before for our other ES6 work?