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

Fix mocha-context-to-closure error when mixing setup/this/CallExpression #94

Closed
GoodForOneFare opened this issue May 22, 2016 · 0 comments
Assignees

Comments

@GoodForOneFare
Copy link
Member

esify spits out this error:

undefined does not match field "name": string of type Identifier
  test/theme-editor-next-javascripts/functional/design_mode/shopify_api_next_test.coffee

The problem is in this setup code:

    for key, event of DesignMode.API.EVENTS
      @[key.toLowerCase()] = @spy()
      document.removeEventListener(event, @[key.toLowerCase()])

Things are fine if:

  • remove-useless-return-from-test is disabled
  • @[key.toLowerCase()] lines are changed to foo[key.toLowerCase()]
  • The toLowerCase() call is removed

Minimal failing test input:

suite('DesignMode.ShopifyApi', function() {
  setup(function() {
    for (let [key, event] of foo) {
      this[key.toLowerCase()] = bar;
    }
  });
});
@GoodForOneFare GoodForOneFare changed the title Fix mocha-context-to-closure setup/this/CallExpression Fix mocha-context-to-closure error when mixing setup/this/CallExpression May 22, 2016
@lemonmade lemonmade self-assigned this May 24, 2016
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

2 participants