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 flow types and enable flow types testing on CI #896

Merged
merged 2 commits into from May 27, 2020

Conversation

rchl
Copy link
Contributor

@rchl rchl commented May 26, 2020

The change related to getChoiceIndex is IMO a correct fix. It's necessary as just declaring getChoiceIndex as a method of the class makes it read-only and that is not compatible with flow types that have getChoiceIndex as a property (correctly as this method is overridable through VueI18n.prototype).

Also enables unit tests and flow types testing on CI

@rchl rchl force-pushed the fix/types-flow branch 4 times, most recently from 0933a51 to e73f7a5 Compare May 26, 2020 20:24
@rchl
Copy link
Contributor Author

rchl commented May 26, 2020

@kazupon I see that you have fixed the types (or partly fixed partly ignored). Here is some more fixes so that the onComponentInstanceCreated call doesn't have to be ignored and also enabling Unit and Flow types testing on CI.

Browser tests still crashing, not sure why.

@rchl rchl marked this pull request as draft May 27, 2020 06:24
@rchl
Copy link
Contributor Author

rchl commented May 27, 2020

I'll have to check if this change still allows overriding the protototype. I'm afraid it might not...

@codecov-commenter
Copy link

codecov-commenter commented May 27, 2020

Codecov Report

Merging #896 into v8.x will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             v8.x     #896      +/-   ##
==========================================
+ Coverage   96.29%   96.31%   +0.02%     
==========================================
  Files          10       10              
  Lines         891      896       +5     
==========================================
+ Hits          858      863       +5     
  Misses         33       33              
Impacted Files Coverage Δ
src/index.js 97.56% <100.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8b3c405...6fd1121. Read the comment docs.

Copy link
Owner

@kazupon kazupon left a comment

Choose a reason for hiding this comment

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

Thank you for your PR!
It seem to be good. 👍
I've just tried CI, and it's succeeded. (why CI failed, I'm not sure 😅 )

@kazupon kazupon marked this pull request as ready for review May 27, 2020 14:45
@rchl
Copy link
Contributor Author

rchl commented May 27, 2020

Let me just double-check later that overriding getChoiceIndex on prototype still works as I'm a bit concerned it might be overwritten on creating the instance.

@rchl rchl marked this pull request as draft May 27, 2020 14:47
@rchl
Copy link
Contributor Author

rchl commented May 27, 2020

Yes, actually that change breaks overriding through prototype.
Funnily enough, the unit tests that are supposed to test that are broken (using assert in a wrong way)...

rchl added 2 commits May 27, 2020 20:29
The tests were using "assert" function wrong.
"assert" is defined as: assert(value, [message])

The tests passed two arguments in an attempt to compare them while
the only thing that happened was that the first value was checked for
being truthy.
Types fixed by making "getChoiceIndex" method follow types and be
a class property rather than class method. Class methods are "read-only"
in flow and that wasn't compatible with flow types that are defining
that function as a property (to allow overriding through prototype changing).
@rchl rchl marked this pull request as ready for review May 27, 2020 18:31
@rchl
Copy link
Contributor Author

rchl commented May 27, 2020

Now it's ready.
Fixed some broken tests and fixed types properly now.

@rchl rchl changed the title Fix flow types Fix flow types and enable flow types testing on CI May 27, 2020
@kazupon
Copy link
Owner

kazupon commented May 27, 2020

Thank you very much!

@kazupon kazupon added the Type: Bug Bug or Bug fixes label May 27, 2020
@kazupon kazupon merged commit 092065e into kazupon:v8.x May 27, 2020
@rchl rchl deleted the fix/types-flow branch May 27, 2020 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: merged Type: Bug Bug or Bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants