scottohara / loot

An implementation of some of the core MS Money features in Ruby on Rails
MIT License
4 stars 3 forks source link

Protractor doesn't support Reflect API #112

Closed scottohara closed 8 years ago

scottohara commented 8 years ago

In protractor.conf.js, the onPrepare() function attaches Chai's should property to all objects.

Due to eslint's prefer-reflect rule, we do this using the Reflect API:

Reflect.defineProperty(protractor.promise.Promise.prototype, "should", Reflect.getOwnPropertyDescriptor(Object.prototype, "should"));

However, since the upgrade to babel 6, to use Reflect requires babel-polyfill; which doesn't seem to work properly when required in protractor.conf.js.

To workaround this, the code has been changed back to using Object; and we have included exceptions in the prefer-reflect rule config for defineProperty and getOwnPropertyDescriptor methods so that they don't trigger a warning:

Object.defineProperty(protractor.promise.Promise.prototype, "should", Object.getOwnPropertyDescriptor(Object.prototype, "should"));

Once node@6.0.0 arrives, which should have native support for Reflect; we can remove the eslint exceptions, and revert back to using the Reflect API natively.

scottohara commented 8 years ago

Confirmed working in node 6. Reverted to Reflect API.