Skip to content

Conversation

@raymondfeng
Copy link
Contributor

@raymondfeng raymondfeng commented Aug 7, 2018

Fixes #1565

Checklist

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

Copy link
Contributor

@virkt25 virkt25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to set options.ownMetadataOnly? Should this behaviour be documented?

@shimks
Copy link
Contributor

shimks commented Aug 8, 2018

@virkt25 If you're asking whether users should have the option to look for the just the subclass' metadata, I think we should but maybe in a separate PR as a feature later on.

@virkt25
Copy link
Contributor

virkt25 commented Aug 8, 2018

Sort of, Just wanted to know if the user had any control over setting this flag or not.

Also this behaviour should be documented somewhere in the docs so users know what to expect when extending a class using DI.

if (target.toString().match(/\s+constructor\s*\([^\)]*\)\s+\{/m)) {
options.ownMetadataOnly = true;
}
} else if (target.hasOwnProperty(method)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this code block covered in a test?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Coveralls, this branch is executed several times (14x) by our test suite. However, I cannot tell if there is a test that would fail if this branch was not present.

@raymondfeng could you please add an explicit test for this branch?

@raymondfeng
Copy link
Contributor Author

@bajtos Any opinions?

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raymondfeng the test case is legitimate. The implementation is a bit hacky, but I am ok with that since the ugliness is limited to a single place.

@raymondfeng raymondfeng merged commit 8c0bdb6 into master Aug 14, 2018
@virkt25 virkt25 added this to the August Milestone milestone Aug 15, 2018
@raymondfeng raymondfeng deleted the fix-issue-1565 branch August 31, 2018 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants