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

AF-2799: Remove mirrors from tests #219

Merged
merged 4 commits into from
Dec 28, 2018

Conversation

corwinsheahan-wf
Copy link
Contributor

Ultimate problem:

Usages of dart mirrors go away in dart 2

How it was fixed:

Remove usages of dart mirrors.

Testing suggestions:

[ ] CI Passes

Potential areas of regression:

Test coverage


FYA: @greglittlefield-wf @aaronlademann-wf @kealjones-wk @evanweible-wf @sebastianmalysa-wf

@aviary2-wf
Copy link

Security Insights

No security relevant content was detected by automated scans.

Action Items

  • Review PR for security impact; comment "security review required" if needed or unsure
  • Verify aviary.yaml coverage of security relevant code

Questions or Comments? Reach out on Slack: #support-infosec.

@codecov-io
Copy link

Codecov Report

Merging #219 into master will decrease coverage by 5.72%.
The diff coverage is n/a.

@@            Coverage Diff            @@
##           master    #219      +/-   ##
=========================================
- Coverage   95.82%   90.1%   -5.71%     
=========================================
  Files          35      35              
  Lines        1767    1767              
=========================================
- Hits         1693    1592     -101     
- Misses         74     175     +101

test('cannot set / read values that are not its prop map', () {
var instance = instanceBuilder();
expect(() {instance['notThere'];},
throwsA(hasToStringValue(contains('Map does not contain this key'))));
});
for (var propKey in keys) {
test('prop: $propKey can have its value set / read', () {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These tests were only intended to verify that the code generation for implementing concrete getters/setters was working properly, and that these props classes had a prop key namespace of '', (except for the case of aria props, which are prefixed with aria-). Therefore, these tests have been simplified here to just test on a few of the props on a mixin.

'react.SyntheticEvent',
'react.SyntheticMouseEvent',
], override: 'mockito')
import 'dart:mirrors';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@greglittlefield-wf were these needed? afaik, the only usage of mirrors within mockito was spy(), which I didn't find any usages of in over_react's tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

Mm, looks like these were added under the false assumption that Mock classes used mirrors.

Away with them! 😄

@robbecker-wf
Copy link
Member

+10 CI does indeed pass

Copy link
Contributor

@evanweible-wf evanweible-wf left a comment

Choose a reason for hiding this comment

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

Looks good, just one nit. It would be good to try out pub build on wdesk using this branch just to ensure there aren't any other hidden mirrors issues that might crop up during dart2js compilation. Sorry – forgot all of these mirrors usages were outside of lib/.

@@ -83,12 +82,12 @@ main() {
if (expectedTagName == 'missingGlyph') expectedTagName = 'missing-glyph';
if (expectedTagName.startsWith(new RegExp('svg.'))) expectedTagName = expectedTagName.substring(3);

test('Dom.$name generates the correct type', () {
DomProps builder = domClassMirror.invoke(element, []).reflectee;
test('${method.toString()} generates the correct type', () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Using .toString() inside a string interpolation is redundant:

Suggested change
test('${method.toString()} generates the correct type', () {
test('$method generates the correct type', () {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦‍♂️

@greglittlefield-wf
Copy link
Contributor

@Workiva/release-management-pp

@rmconsole5-wk rmconsole5-wk merged commit 014965f into master Dec 28, 2018
@rmconsole5-wk rmconsole5-wk deleted the AF-2799_remove_mirrors_from_tests branch December 28, 2018 20:38
@evanweible-wf evanweible-wf added this to the Dart 2 Compat milestone Jan 7, 2019
@evanweible-wf evanweible-wf added the dart2 PRs targeting our effort to get to Dart SDK 2.0 compatibility label Jan 7, 2019
@evanweible-wf evanweible-wf modified the milestones: Dart 2 Compat, 2.0.0 (Dart 1 & 2 compatibility) Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dart2 PRs targeting our effort to get to Dart SDK 2.0 compatibility Merge Requirements Met RM Ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants